-
Notifications
You must be signed in to change notification settings - Fork 17
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
[WIP] Add createModernBuild option #188
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,16 @@ const createWebpackConfigBase = require('./create-webpack-config-base'); | |
function createWebpackConfigStatic( | ||
batfishConfig: BatfishConfiguration | ||
): Promise<webpack$Configuration> { | ||
return createWebpackConfigBase(batfishConfig).then(baseConfig => { | ||
// For the static build always set up Babel to compile only what's necessary | ||
// for the current version of Node. | ||
return createWebpackConfigBase( | ||
Object.assign({}, batfishConfig, { | ||
babelPresetEnvOptions: { | ||
useBuiltIns: true, | ||
targets: { node: 'current' } | ||
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. I don't understand why we only need to compile what's necessary for the current version of Node. Can you explain why this is the case? 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. When we're using Node 6, we get a lot of ES2015 without compilation. So we should in theory have faster compile-time and maybe even faster runtime if, for example, we don't compile classes and arrow functions, which Node 6 understands. 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. So the set of ES features that get compiled, and end up in the static bundle, are driven by the version of Node that compiles the assets? If I'm understanding this correctly, I feel like this could result in some confusion. 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. As we clarified in chat: The misunderstanding here was about where and when the static bundle runs. The output of this Webpack task is just |
||
} | ||
}) | ||
).then(baseConfig => { | ||
const staticConfig: webpack$Configuration = { | ||
entry: { | ||
static: path.join(__dirname, '../webpack/static-render-pages.js') | ||
|
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.
Change this back to avoid those annoying Webpack messages about deoptimization.