-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #452 from guardian/rm/bump-webpack
Bump Webpack to version 4
- Loading branch information
Showing
24 changed files
with
11,067 additions
and
14,344 deletions.
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"plugins": ["@babel/plugin-transform-object-assign"] | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,46 +1,64 @@ | ||
var path = require('path'); | ||
var ExtractTextPlugin = require('extract-text-webpack-plugin'); | ||
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); | ||
|
||
module.exports = { | ||
devtool: 'source-map', | ||
mode: 'development', | ||
module: { | ||
loaders: [ | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
use: [{ | ||
loader: "babel-loader", | ||
options: { | ||
presets: ["@babel/preset-env", "@babel/preset-react"] | ||
} | ||
}], | ||
exclude: /node_modules/, | ||
loaders: ['babel?presets[]=es2015&presets[]=react&plugins[]=transform-object-assign'] | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
loader: ExtractTextPlugin.extract('style-loader', 'css-loader?sourceMap!sass-loader?sourceMap') | ||
test: /\.css$/i, | ||
use: [MiniCssExtractPlugin.loader, "css-loader"], | ||
}, | ||
{ | ||
test: /\.css$/, | ||
loader: ExtractTextPlugin.extract('style-loader', 'css-loader?sourceMap') | ||
test: /\.scss$/, | ||
use: [ | ||
MiniCssExtractPlugin.loader, | ||
{ | ||
loader: "css-loader", | ||
}, | ||
"sass-loader" | ||
] | ||
}, | ||
{ | ||
test: /\.woff(2)?(\?v=[0-9].[0-9].[0-9])?$/, | ||
loader: "url-loader?mimetype=application/font-woff" | ||
use: [{loader: "url-loader", options: {mimetype: 'application/font-woff'}}] | ||
}, | ||
{ | ||
test: /\.(ttf|eot|svg|gif)(\?v=[0-9].[0-9].[0-9])?$/, | ||
loader: "file-loader?name=[name].[ext]" | ||
use: [ | ||
{ | ||
loader: 'file-loader', | ||
options: { | ||
name: '[name].[ext]', | ||
outputPath: 'fonts/' | ||
} | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
resolveLoader: { | ||
root: path.join(__dirname, '..', 'node_modules') | ||
}, | ||
|
||
sassLoader: { | ||
includePaths: [path.resolve(__dirname, '../style')] | ||
}, | ||
|
||
resolve: { | ||
extensions: ['', '.js', '.jsx', '.json', '.scss'] | ||
modules: [ | ||
path.join(__dirname, "src"), | ||
"node_modules" | ||
], | ||
// Allows require('file') instead of require('file.js|x') | ||
extensions: ['.js', '.jsx', '.json'] | ||
}, | ||
|
||
plugins: [ | ||
new ExtractTextPlugin('main.css') | ||
new MiniCssExtractPlugin({filename: 'main.css'}), | ||
] | ||
}; |
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 |
---|---|---|
@@ -1,55 +1,68 @@ | ||
var webpack = require('webpack'); | ||
var path = require('path'); | ||
var ExtractTextPlugin = require('extract-text-webpack-plugin'); | ||
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); | ||
|
||
module.exports = { | ||
bail: true, | ||
mode: 'production', | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: 'app.js' | ||
}, | ||
module: { | ||
loaders: [ | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
test: /\.js$/, | ||
use: [{ | ||
loader: "babel-loader", | ||
options: { | ||
presets: ["@babel/preset-env", "@babel/preset-react"] | ||
} | ||
}], | ||
exclude: /node_modules/, | ||
loaders: ['babel?presets[]=es2015&presets[]=react&plugins[]=transform-object-assign'] | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!sass-loader') | ||
test: /\.css$/, | ||
use: [MiniCssExtractPlugin.loader, "css-loader"], | ||
}, | ||
{ | ||
test: /\.css$/, | ||
loader: ExtractTextPlugin.extract('style-loader', 'css-loader') | ||
test: /\.scss$/, | ||
use: [ | ||
MiniCssExtractPlugin.loader, | ||
{ | ||
loader: "css-loader", | ||
}, | ||
"sass-loader" | ||
] | ||
}, | ||
{ | ||
test: /\.woff(2)?(\?v=[0-9].[0-9].[0-9])?$/, | ||
loader: "url-loader?mimetype=application/font-woff" | ||
use: [{loader: "url-loader", options: {mimetype: 'application/font-woff'}}] | ||
}, | ||
{ | ||
test: /\.(ttf|eot|svg|gif)(\?v=[0-9].[0-9].[0-9])?$/, | ||
loader: "file-loader?name=[name].[ext]" | ||
use: [ | ||
{ | ||
loader: 'file-loader', | ||
options: { | ||
name: '[name].[ext]', | ||
outputPath: 'fonts/' | ||
} | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
new ExtractTextPlugin('main.css'), | ||
new webpack.DefinePlugin({ | ||
'process.env': { | ||
'NODE_ENV': '"production"' | ||
} | ||
}), | ||
new MiniCssExtractPlugin({filename: 'main.css'}), | ||
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), | ||
new webpack.optimize.DedupePlugin(), | ||
new webpack.optimize.OccurenceOrderPlugin(), | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
warnings: false | ||
} | ||
}) | ||
], | ||
resolveLoader: { | ||
root: path.join(__dirname, '..', 'node_modules') | ||
}, | ||
|
||
resolve: { | ||
extensions: ['', '.js', '.jsx', '.json'] | ||
modules: [ | ||
path.join(__dirname, "src"), | ||
"node_modules" | ||
], | ||
extensions: ['.js', '.jsx', '.json'] | ||
} | ||
}; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.