-
Notifications
You must be signed in to change notification settings - Fork 177
Configure transform-runtime for all builds #162
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,14 +7,10 @@ | |
} | ||
] | ||
], | ||
"plugins": "transform-runtime", | ||
"env": { | ||
"test": { | ||
"presets": ["env"] | ||
}, | ||
"production": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this "production" config was not being used. |
||
"plugins": [ | ||
"transform-runtime" | ||
] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,27 +3,24 @@ import commonjs from 'rollup-plugin-commonjs'; | |
import nodeResolve from 'rollup-plugin-node-resolve'; | ||
import replace from 'rollup-plugin-replace'; | ||
import uglify from 'rollup-plugin-uglify'; | ||
import { dependencies } from './package.json' | ||
|
||
const env = process.env.NODE_ENV; | ||
const config = { | ||
entry: 'src/index.js', | ||
plugins: [], | ||
}; | ||
|
||
const externals = Object.keys(dependencies).join('|'); | ||
|
||
if (env === 'es' || env === 'cjs') { | ||
config.format = env; | ||
config.sourceMap = true; | ||
config.external = [ | ||
'invariant', | ||
'lodash.curry', | ||
'lodash.isfunction', | ||
'lodash.isobject', | ||
'lodash.isplainobject', | ||
'lodash.map', | ||
'redux', | ||
]; | ||
config.external = id => RegExp(`^(${externals})(\/.*)?$`).test(id); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any reason this is not just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because then it would not externalize There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh gotcha, that makes sense. |
||
config.plugins.push( | ||
babel() | ||
babel({ | ||
runtimeHelpers: true, | ||
}) | ||
) | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be an array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deini it can be an array or a string (eg if you only have one plugin). Happy to change it to an array.