Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Don't tie mode to NODE_ENV in Webpack config #261

Closed
arxpoetica opened this issue May 7, 2018 · 2 comments
Closed

Don't tie mode to NODE_ENV in Webpack config #261

arxpoetica opened this issue May 7, 2018 · 2 comments
Labels

Comments

@arxpoetica
Copy link
Member

Was getting the following bug when NODE_ENV was set to staging:

$ sapper build
> Building...
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.mode should be one of these:
   "development" | "production" | "none"

In other words, mode is not vis-a-vis the same as NODE_ENV in Webpack land. So this won't fly:

const mode = process.env.NODE_ENV;

Gosh. 🙃

We could in theory do something like the following:

const mode = process.env.NODE_ENV === 'production' ? 'production' : 'development';

But that's pretty limiting. CLI option? ENV var? https://webpack.js.org/concepts/mode/ mentions passing as config:

webpack --mode=production
@arxpoetica arxpoetica added the bug label May 7, 2018
@arxpoetica
Copy link
Member Author

Wrong place for issue. Moved here: sveltejs/sapper-template#58

@kalashnikovisme
Copy link

Wrong place, but this hint is very useful. thanks)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants