-
Notifications
You must be signed in to change notification settings - Fork 972
Upgrade to Webpack 3 #10279
Upgrade to Webpack 3 #10279
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
"react", | ||
["env", { | ||
"targets": { | ||
"chrome": 57 | ||
"chrome": 60 | ||
} | ||
}] | ||
], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ | |
"vagrant-rsync-linux": "VAGRANT_CWD=./test/vms/vagrant/ubuntu-14.04 vagrant rsync-auto", | ||
"vagrant-ssh-linux": "VAGRANT_CWD=./test/vms/vagrant/ubuntu-14.04 vagrant ssh", | ||
"vagrant-up-linux": "VAGRANT_CWD=./test/vms/vagrant/ubuntu-14.04 vagrant up", | ||
"watch": "webpack-dev-server --inline --hot --colors --content-base=./app/extensions/brave", | ||
"watch": "webpack-dev-server --color", | ||
"watch-all": "npm run watch & npm run watch-test", | ||
"watch-test": "cross-env NODE_ENV=test webpack --watch", | ||
"webpack": "webpack", | ||
|
@@ -130,7 +130,7 @@ | |
"asar": "^0.11.0", | ||
"babel": "^6.1.18", | ||
"babel-core": "^6.3.15", | ||
"babel-loader": "^6.2.0", | ||
"babel-loader": "^7.1.1", | ||
"babel-plugin-transform-react-constant-elements": "^6.4.0", | ||
"babel-plugin-transform-react-inline-elements": "^6.4.0", | ||
"babel-polyfill": "^6.3.14", | ||
|
@@ -181,11 +181,11 @@ | |
"spectron": "brave/spectron#chromium60", | ||
"standard": "9.0.0", | ||
"style-loader": "^0.13.0", | ||
"uglify-js-harmony": "^2.7.5", | ||
"uglifyjs-webpack-plugin": "^1.0.0-beta.2", | ||
"uuid": "^3.0.1", | ||
"webdriverio": "4.7.1", | ||
"webpack": "^1.12.9", | ||
"webpack-dev-server": "^1.14.0", | ||
"webpack": "~3.4.1", | ||
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 is already old 😄 ... latest is |
||
"webpack-dev-server": "~2.6.1", | ||
"webpack-notifier": "^1.2.1", | ||
"xml2js": "^0.4.15" | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ function config () { | |
devtool: '#source-map', | ||
cache: true, | ||
module: { | ||
loaders: [ | ||
rules: [ | ||
{ | ||
test: /\.js?$/, | ||
exclude: [ | ||
|
@@ -23,7 +23,7 @@ function config () { | |
path.resolve(__dirname, 'app', 'browser', '*'), | ||
path.resolve(__dirname, 'app', 'extensions', '*') | ||
], | ||
loader: 'babel' | ||
loader: 'babel-loader' | ||
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 guess we should update it to 7.1 to match webpack3. current version (6.2.0) only matches 1.x and 2.x (with deprecation warnings) 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. 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. upgraded |
||
}, | ||
{ | ||
test: /\.less$/, | ||
|
@@ -33,10 +33,6 @@ function config () { | |
test: /\.css$/, | ||
loader: 'style-loader!css-loader?-minimize' | ||
}, | ||
{ | ||
test: /\.json$/, | ||
loader: 'json' | ||
}, | ||
// Loads font files for Font Awesome | ||
{ | ||
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, | ||
|
@@ -49,7 +45,7 @@ function config () { | |
] | ||
}, | ||
resolve: { | ||
extensions: ['', '.js', '.jsx'] | ||
extensions: ['.js', '.jsx'] | ||
}, | ||
externals: { | ||
'electron': 'chrome' | ||
|
@@ -89,7 +85,11 @@ function watchOptions () { | |
|
||
function development () { // eslint-disable-line | ||
var dev = config() | ||
dev.plugins.push(new webpack.HotModuleReplacementPlugin()) | ||
dev.devServer = { | ||
contentBase: path.resolve(__dirname, 'app', 'extensions', 'brave'), | ||
hot: true, | ||
inline: true, | ||
publicPath: 'http://localhost:' + port + '/gen/', | ||
headers: { 'Access-Control-Allow-Origin': '*' } | ||
} | ||
|
@@ -98,15 +98,17 @@ function development () { // eslint-disable-line | |
|
||
function production () { // eslint-disable-line | ||
var prod = config() | ||
prod.plugins.push(new webpack.optimize.DedupePlugin()) | ||
var UglifyJsPlugin = require('uglifyjs-webpack-plugin') | ||
prod.plugins.push(new webpack.optimize.OccurrenceOrderPlugin(true)) | ||
if (env !== 'test') { | ||
prod.plugins.push(new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
warnings: false | ||
}, | ||
mangle: { | ||
except: ['module', 'exports', 'require'] | ||
prod.plugins.push(new UglifyJsPlugin({ | ||
uglifyOptions: { | ||
compress: { | ||
warnings: false | ||
}, | ||
mangle: { | ||
reserved: ['module', 'exports', 'require'] | ||
} | ||
} | ||
})) | ||
} | ||
|
@@ -117,9 +119,14 @@ function test () { // eslint-disable-line | |
return Object.assign(production(), watchOptions()) | ||
} | ||
|
||
function merge (config, env) { | ||
var merged = Object.assign({}, env, config) | ||
merged.plugins = (config.plugins || []).concat(env.plugins || []) | ||
function merge (config, envConfig) { | ||
var merged = Object.assign({}, envConfig, config) | ||
merged.plugins = (config.plugins || []).concat(envConfig.plugins || []) | ||
// In development we overwrite the output path so the dev server serves everything from the gen subdir | ||
if (env === 'development') { | ||
// Note that this directory will never be created since the dev server does not write out to files | ||
merged.output.path = path.resolve(__dirname, 'app', 'extensions', 'gen') | ||
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. it wrote for me. maybe put in also having 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. weird, I will add to that is expected and the same behavior as before (content base was previously set via |
||
} | ||
return merged | ||
} | ||
|
||
|
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.
This is a great change too 😄