2019-11-28 11:50:51 +01:00
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
// Plugins
|
|
|
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
|
|
|
|
|
|
const env = process.env;
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
mode: `${env.NODE_ENV ? env.NODE_ENV : 'production'}`,
|
|
|
|
entry: './src/index.js',
|
|
|
|
devtool: 'inline-source-map',
|
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, 'dist')
|
|
|
|
},
|
2019-11-28 14:12:48 +01:00
|
|
|
resolve: {
|
|
|
|
extensions: [ '.jsx', '.js' ],
|
|
|
|
},
|
2019-11-28 11:50:51 +01:00
|
|
|
module: {
|
|
|
|
rules: [{
|
2019-11-28 14:12:48 +01:00
|
|
|
test: /\.scss$/,
|
2019-11-28 11:50:51 +01:00
|
|
|
use: [
|
|
|
|
MiniCssExtractPlugin.loader,
|
|
|
|
{
|
|
|
|
loader: "css-loader",
|
|
|
|
options: {}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: "resolve-url-loader",
|
|
|
|
options: {}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: "sass-loader",
|
|
|
|
options: {
|
|
|
|
sourceMap: true,
|
|
|
|
sourceMapContents: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},{
|
|
|
|
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
|
|
|
|
use: [{
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
name: '[name].[ext]',
|
|
|
|
outputPath: '/fonts/'
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
},{
|
|
|
|
test: /\.(html)$/,
|
|
|
|
use: [{
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
name: '[name].[ext]'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'extract-loader',
|
|
|
|
{
|
|
|
|
loader: 'html-loader',
|
|
|
|
options: {}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},{
|
2019-11-28 14:12:48 +01:00
|
|
|
test: /\.(js|jsx)$/,
|
2019-11-28 11:50:51 +01:00
|
|
|
exclude: /node_modules/,
|
2019-11-28 14:12:48 +01:00
|
|
|
use: ['babel-loader']
|
2019-11-28 11:50:51 +01:00
|
|
|
}]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new MiniCssExtractPlugin({
|
|
|
|
filename: "css/[name].css",
|
|
|
|
chunkFilename: "css/[id].css"
|
|
|
|
})
|
|
|
|
]
|
|
|
|
}
|