sapper-template icon indicating copy to clipboard operation
sapper-template copied to clipboard

webpack throws warning

Open svenlindstroem opened this issue 5 years ago • 3 comments

Describe the bug Building with sapper webpack throws warning when running npm run build.

Logs WARNING in configuration The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment. You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/

To Reproduce npm run build

  • If possible, we recommend creating a small repo that illustrates the problem.
  • Reproductions should be small, self-contained, correct examples – http://sscce.org.

Expected behavior No warnings

Information about your Sapper Installation: macOS High Sierra sapper webpack node 12.9.1 sapper 0.27.0 svelte 3.0.0

Severity annoying

svenlindstroem avatar Nov 29 '19 23:11 svenlindstroem

Have you tried to do set node_env=production && npm run build

JefferyHus avatar Nov 29 '19 23:11 JefferyHus

Yes thanks, I have got it running. Still, should be in the readme. Or adding a .env file.

svenlindstroem avatar Nov 29 '19 23:11 svenlindstroem

On Windows I had to install cross-env as a dev dependency: npm i -D cross-env

and change scripts.build in package.json to this: node_modules/.bin/cross-env NODE_ENV=production \"npm run build:tailwind && sapper build\"

Anything else either got the warning the OP described or caused Webpack to throw this exception.

 - configuration.mode should be one of these:
   "development" | "production" | "none"
   -> Enable production optimizations or development hints.```

tvanc avatar Dec 22 '19 05:12 tvanc