chore(webpack) only apply transform-runtime to prod build
This will allow this package to npm-link'ed by not using transform-runtime unless we're building production.
@justinanastos looks interesting—did this implementation come from an article?
also,
what is the difference between that implementation and the following:
process.env.BABEL_ENV = 'production';
process.env.NODE_ENV = 'production';
or
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
})
@chemoish This did not come from an article. When trying to npm link this package, there was an issue with transform-runtime. Since that's only needed for prod, this will only use it on prod.
- I didn't want to require environmental variables be set to make this work.
-
webpack.DefinePlugin()will define things for the transpiled source, it won't set theenvfor.babelrc(I think)
This solution comes from the babel-loader docs to just set the local environment regardless of NODE_ENV or BABEL_ENV. [email protected]#options
I got the idea to test removing transform-runtime from this post https://stackoverflow.com/questions/36313885/babel-6-transform-runtime-export-is-not-a-function
BABEL_ENV=production webpack --config webpack/webpack.config.production?
is the workflow to manually run npm run build after changes? or are you also trying to leverage npm start?
I was just using the source and not the built file.