85 lines
1.7 KiB
JavaScript
85 lines
1.7 KiB
JavaScript
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')
|
|
},
|
|
module: {
|
|
rules: [{
|
|
test: /\.(scss)|(sass)$/,
|
|
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: {}
|
|
}
|
|
]
|
|
},{
|
|
test: /\.riot$/,
|
|
exclude: /node_modules/,
|
|
use: [{
|
|
loader: '@riotjs/webpack-loader',
|
|
options: {
|
|
hot: false,
|
|
}
|
|
}]
|
|
},{
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
options: {
|
|
presets: ['@babel/preset-env']
|
|
}
|
|
}
|
|
}]
|
|
},
|
|
plugins: [
|
|
new MiniCssExtractPlugin({
|
|
filename: "css/[name].css",
|
|
chunkFilename: "css/[id].css"
|
|
})
|
|
]
|
|
} |