Files
app.ethica-spinoza.net/webpack.config.js
T

58 lines
1.4 KiB
JavaScript

/**
* @Author: Bachir Soussi Chiadmi <bach>
* @Date: 11-04-2017
* @Email: bachir@figureslibres.io
* @Last modified by: bach
* @Last modified time: 16-04-2017
* @License: GPL-V3
*/
const webpack = require('webpack');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: ["./assets/main.js", "./assets/main.scss"],
output: {
path: __dirname + "/assets/dist/",
filename: "main.js"
},
devtool: 'source-map',
module: {
rules: [
/* your other rules for JavaScript transpiling go in here */
{
// regular css files
test: /\.css$/,
use: ExtractTextPlugin.extract({ use: 'css-loader?importLoaders=1', }),
},
{
// sass / scss loader for webpack
test: /\.(sass|scss)$/,
use: ExtractTextPlugin.extract(['css-loader', 'sass-loader'])
},
{
// fonts
test: /\.(eot|svg|ttf|woff|woff2)$/,
use: "file-loader?name=fonts/[name].[ext]"
},
]
},
plugins: [
new ExtractTextPlugin({
// define where to save the file
filename: '[name].css', allChunks: true,
}),
new UglifyJsPlugin({
sourceMap: true,
uglifyOptions: {
ecma: 8,
compress: {
warnings: false
},
}
})
],
watch: true
};