Unable to seperate public from private packages
This went perfectly fine till I decided to introduce node-sass to my project which is a backend package.
My problem is that node-sass including all its dependencies end up in my public/components folder. Ideally I'd only use Yarn for my public packages and npm for my backend packages (which would end up in node_modules in my project root). But they both use the same package.json file.
Is there a way to split these package managers? Or am I going about this entirely the wrong way.
1 Answers Unable to seperate public from private packages
As I mentioned in my comment, this is a very odd way to set things up. Typically you would do this:
- Use a single package manager (NPM or Yarn), because mixing them doesn't usually work well. NPM uses
package-lock.jsonand yarn uses
yarn.lockto determine what package version to download so you may end up with dependency mismatches.
- Use webpack to create a package bundle, since you are using Laravel you should use Laravel Mix
- If necessary you can extract vendor packages to create bundles that have a higher chance of hitting the browser cache.
- You can also use SCSS for your stylesheets
The main reasons to not put the modules directly in your public folder are:
- You will need to load them as modules, however IE does not allow that at all.
- You will end up putting all the dependencies and dev dependencies of those modules in the public folder which is unessesary.
Overall I think it's best practice to compile your assets.