Skip to content

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. babel-loader@6.4.1#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