Created
April 26, 2018 05:18
-
-
Save ngohungphuc/9ba57bfb51b207e151612ca6f9d9cfd9 to your computer and use it in GitHub Desktop.
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
//for more detail please visit | |
//https://github.com/Awesome-CMS-Core/Awesome-CMS-Core/blob/master/src/AwesomeCMSCore/AwesomeCMSCore/webpack.config.js | |
const path = require("path"); | |
const webpack = require("webpack"); | |
const ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
const extractCSS = new ExtractTextPlugin("cmscore.css"); | |
const CompressionPlugin = require("compression-webpack-plugin"); | |
module.exports = { | |
entry: { | |
main: "./React/js/main.js" | |
}, | |
output: { | |
path: path.resolve(__dirname, "wwwroot/dist"), | |
filename: "[name].js", | |
publicPath: "/dist/" | |
}, | |
plugins: [ | |
extractCSS, | |
new webpack.ProvidePlugin({ | |
$: "jquery", | |
jQuery: "jquery", | |
Popper: ['popper.js', 'default'] | |
}), | |
new webpack.optimize.UglifyJsPlugin(), | |
new CompressionPlugin({ | |
test: /\.(js|css)/ | |
}) | |
], | |
module: { | |
loaders: [ | |
{ | |
test: /\.scss$/, | |
use: extractCSS.extract({ | |
use: [ | |
{ | |
loader: "css-loader", | |
options: { | |
minimize: true, | |
sourceMap: true | |
} | |
}, | |
{ | |
loader: "sass-loader" | |
} | |
], | |
// use style-loader in development | |
fallback: "style-loader" | |
}) | |
}, | |
{ | |
test: /\.(js|jsx)$/, | |
exclude: /node_modules/, | |
loader: ["babel-loader", "eslint-loader"] | |
}, | |
{ | |
test: /\.(jpe?g|png|gif)$/i, | |
loader: "file-loader" | |
}, | |
{ | |
test: /\.(woff|ttf|otf|eot|woff2|svg)$/i, | |
loader: "file-loader" | |
} | |
] | |
}, | |
watch: true | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment