This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Upgrade dev build tooling (Babel 6 -> 7, Webpack 1 -> 4) #1235
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
{ | ||
"presets": ["react", "es2015", "stage-0"], | ||
"plugins": [ | ||
["@babel/plugin-transform-flow-strip-types"], | ||
["@babel/plugin-proposal-class-properties", { "loose": false }] | ||
], | ||
"presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-flow"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,38 +9,37 @@ | |
*/ | ||
'use strict'; | ||
|
||
var webpack = require('webpack'); | ||
var __DEV__ = process.env.NODE_ENV !== 'production'; | ||
const {readFileSync} = require('fs'); | ||
const {resolve} = require('path'); | ||
const webpack = require('webpack'); | ||
|
||
const __DEV__ = process.env.NODE_ENV !== 'production'; | ||
|
||
module.exports = { | ||
debug: true, | ||
devtool: 'source-map', | ||
mode: __DEV__ ? 'development' : 'production', | ||
devtool: __DEV__ ? 'source-map' : false, | ||
entry: { | ||
backend: './src/backend.js', | ||
}, | ||
output: { | ||
path: __dirname + '/build', // eslint-disable-line no-path-concat | ||
path: __dirname + '/build', | ||
filename: '[name].js', | ||
library: 'ReactDevToolsBackend', | ||
libraryTarget: 'umd', | ||
}, | ||
plugins: __DEV__ ? [] : [ | ||
// Ensure we get production React | ||
new webpack.DefinePlugin({ | ||
'process.env.NODE_ENV': '"production"', | ||
}), | ||
// Remove dead code but keep it readable: | ||
new webpack.optimize.UglifyJsPlugin({ | ||
mangle: false, | ||
beautify: true, | ||
}), | ||
], | ||
module: { | ||
loaders: [{ | ||
test: /\.js$/, | ||
loader: 'babel', | ||
exclude: /node_modules/, | ||
}], | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
loader: 'babel-loader', | ||
options: { | ||
...JSON.parse(readFileSync(resolve(__dirname, '../../.babelrc'))), | ||
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. Same thing as above (there are more occurences below, won't comment on those). |
||
}, | ||
}, | ||
], | ||
}, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this spread operator really needed? You could remove the object braces and set
options
to the result of JSON.parseMaybe I'm missing something
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.
Originally, I thought I might add some custom options to individual configs but that turned out not to be necessary.