Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(webpack) only apply transform-runtime to prod build #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

justinanastos
Copy link

This will allow this package to npm-link'ed by not using transform-runtime unless we're building production.

This will allow this package to `npm-link`'ed.
@chemoish
Copy link
Owner

chemoish commented Apr 14, 2017

@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'),
})

@justinanastos
Copy link
Author

@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 the env for .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

@justinanastos
Copy link
Author

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

@chemoish
Copy link
Owner

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?

@justinanastos
Copy link
Author

I was just using the source and not the built file.

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

Successfully merging this pull request may close these issues.

2 participants