Merge branch 'dynamic-import' into node-lib-dynamic

This commit is contained in:
d98762625 2019-02-08 14:42:07 +00:00
commit 7679705369
8 changed files with 357 additions and 178 deletions

View file

@ -1,5 +1,5 @@
const webpack = require("webpack");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const path = require("path");
/**
@ -31,8 +31,6 @@ const banner = `/**
* limitations under the License.
*/`;
const vendorCSS = new ExtractTextPlugin("vendor.css");
const projectCSS = new ExtractTextPlugin("styles.css");
module.exports = {
plugins: [
@ -49,14 +47,33 @@ module.exports = {
new webpack.DefinePlugin({
"process.browser": "true"
}),
vendorCSS,
projectCSS
new MiniCssExtractPlugin({
filename: "[name].css",
}),
],
resolve: {
alias: {
jquery: "jquery/src/jquery",
},
},
// optimization: {
// splitChunks: {
// cacheGroups: {
// styles: {
// name: "styles",
// test: /\.css$/,
// chunks: "all",
// enforce: true
// },
// vendor: {
// name: "vendor",
// test: /\.scss$/,
// chunks: "all",
// enforce: true,
// },
// }
// }
// },
module: {
rules: [
{
@ -80,21 +97,19 @@ module.exports = {
},
{
test: /\.css$/,
use: projectCSS.extract({
use: [
{ loader: "css-loader" },
{ loader: "postcss-loader" },
]
})
use: [
MiniCssExtractPlugin.loader,
"css-loader",
"postcss-loader",
]
},
{
test: /\.scss$/,
use: vendorCSS.extract({
use: [
{ loader: "css-loader" },
{ loader: "sass-loader" }
]
})
use: [
MiniCssExtractPlugin.loader,
"css-loader",
"sass-loader",
]
},
{
test: /\.(ico|eot|ttf|woff|woff2)$/,