fake-sms/webpack.config.js

71 lines
1.6 KiB
JavaScript
Raw Permalink Normal View History

2020-12-21 15:56:56 +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: path.join(__dirname, './cmd/fake-sms/public/src/index.js'),
output: {
filename: '[name].js',
path: path.join(__dirname, './cmd/fake-sms/public/dist')
},
module: {
rules: [{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: ['@babel/plugin-proposal-class-properties']
}
}
},{
test: /\.s(a|c)ss$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: {}
},
{
loader: "resolve-url-loader",
options: {}
},
{
loader: "sass-loader",
options: {
sourceMap: true,
}
}
]
},{
test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: '/fonts/'
}
}]
},{
test: /\.(svg|png|jpg)(\?v=\d+\.\d+\.\d+)?$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: '/img/'
}
}]
}]
},
plugins: [
new MiniCssExtractPlugin({
2023-01-02 10:38:18 +01:00
filename: "./css/[name].css",
chunkFilename: "./css/[id].css"
2020-12-21 15:56:56 +01:00
})
]
}