Update Webpack to version 4
This commit is contained in:
parent
2dc1c5c618
commit
02a185f2fe
4 changed files with 53 additions and 28 deletions
|
@ -26,15 +26,16 @@ module.exports = {
|
|||
"theme-status": "./res/themes/status/css/status.scss",
|
||||
},
|
||||
module: {
|
||||
preLoaders: [
|
||||
{ test: /\.js$/, loader: "source-map-loader" },
|
||||
],
|
||||
loaders: [
|
||||
{ test: /\.json$/, loader: "json" },
|
||||
{ test: /\.js$/, loader: "babel", include: path.resolve('./src') },
|
||||
rules: [
|
||||
{ enforce: 'pre', test: /\.js$/, use: "source-map-loader", exclude: /node_modules/, },
|
||||
{ test: /\.js$/, use: "babel-loader", include: path.resolve(__dirname, 'src') },
|
||||
{
|
||||
test: /\.scss$/,
|
||||
|
||||
include: [
|
||||
path.resolve(__dirname, 'res/themes/status/css/'),
|
||||
path.resolve(__dirname, 'node_modules/matrix-react-sdk/res/themes/light/css/'),
|
||||
path.resolve(__dirname, 'node_modules/matrix-react-sdk/res/themes/dark/css/'),
|
||||
],
|
||||
// 1. postcss-loader turns the SCSS into normal CSS.
|
||||
// 2. css-raw-loader turns the CSS into a javascript module
|
||||
// whose default export is a string containing the CSS.
|
||||
|
@ -42,13 +43,27 @@ module.exports = {
|
|||
// would also drag in the imgs and fonts that our CSS refers to
|
||||
// as webpack inputs.)
|
||||
// 3. ExtractTextPlugin turns that string into a separate asset.
|
||||
loader: ExtractTextPlugin.extract("css-raw-loader!postcss-loader?config=postcss.config.js"),
|
||||
use: ExtractTextPlugin.extract({
|
||||
use: [
|
||||
"css-raw-loader",
|
||||
"postcss-loader"
|
||||
],
|
||||
}),
|
||||
},
|
||||
{
|
||||
// this works similarly to the scss case, without postcss.
|
||||
test: /\.css$/,
|
||||
loader: ExtractTextPlugin.extract("css-raw-loader"),
|
||||
include: [
|
||||
path.resolve(__dirname, "node_modules/matrix-react-sdk/node_modules/highlight.js/styles"),
|
||||
path.resolve(__dirname, "node_modules/matrix-react-sdk/node_modules/draft-js/dist"),
|
||||
path.resolve(__dirname, "node_modules/matrix-react-sdk/node_modules/gfm.css"),
|
||||
path.resolve(__dirname, "node_modules/matrix-react-sdk/node_modules/gemini-scrollbar/"),
|
||||
],
|
||||
use: ExtractTextPlugin.extract({
|
||||
use: "css-raw-loader"
|
||||
}),
|
||||
},
|
||||
|
||||
],
|
||||
noParse: [
|
||||
// for cross platform compatibility use [\\\/] as the path separator
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue