hayes0724 / shopify-packer

Modern development tool for Shopify using Webpack 5. Easy to extend and customize, zero build config, compatible with Slate and existing websites.
https://hayes0724.github.io/shopify-packer/
MIT License
181 stars 37 forks source link

Packer works with NVM, but not with Volta. Issues with various webpack loaders when installed through Volta #141

Closed adrianocr closed 2 years ago

adrianocr commented 3 years ago

Describe the bug These days it is common to install node via a version manager such as https://github.com/nvm-sh/nvm or https://volta.sh/. NVM works but is quite slow compared to Volta.

Right now packer works perfectly via NVM. But it does NOT work via volta. Packer installs globally correctly and you can issue packer commands inside your project, but packer fails to build files due to "missing loaders". Webpack fires up warnings about loaders being missing for SCSS files. If you manually add the loaders, the issue still persists.

This same issue does not happen with NVM. In fact if you have both installed you can easily swap between nvm and volta by having your .bashrc or .zshrc file reference/load one or the other. If you load nvm and run packer build in the directory, everything works swimmingly. If you swap to volta and run packer build, you all of a sudden get the webpack loader errors. This still happens if you remove the node_modules directory and reinstall all packages from scratch.

To Reproduce Steps to reproduce the behavior:

  1. Install volta from https://docs.volta.sh/guide/getting-started
  2. Install node through volta install node
  3. Install yarn globally through volta install yarn
  4. Install packer globally either via yarn global add @hayes0724/shopify-packer or volta install @hayes0724/shopify-packer
  5. Run yarn install within your project's directory
  6. Run packer build within your project's directory

Expected behavior I expect packer to build and bundle everything correctly as it does through a standard node install. What currently happens is a myriad of errors stating that loaders are missing. If I manually add the loaders, and add the rules for the necessary file type (.scss files in this case) to the webpack config in the dev.config file or prod.config file, the issues still persists.

Screenshots Image 2021-09-29 at 12 15 49 PM

System (please complete the following information):

Packer (please complete the following information):

adrianocr commented 2 years ago

This works again in newer packer versions, but specifically if Packer is installed directly into the project instead of globally. To run the various packer commands you need to use your package manager instead of the global packer command. Ex: yarn start runs the local project's packer instead of the global installation.