factorio-server-manager/webpack.config.js

94 lines
2.9 KiB
JavaScript
Raw Normal View History

const path = require('path');
2018-08-20 19:38:33 +02:00
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
2018-08-20 19:38:33 +02:00
entry: {
// js: './ui/index.js',
sass: './ui/index.scss'
},
output: {
filename: 'bundle.js',
2018-08-29 00:47:59 +02:00
path: path.resolve('app'),
publicPath: path.resolve('app')
},
resolve: {
alias: {
Utilities: path.resolve(__dirname, 'ui/js/')
},
extensions: ['.js', '.json', '.jsx']
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
2018-08-20 19:38:33 +02:00
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
2018-08-29 00:47:59 +02:00
"resolve-url-loader",
"sass-loader?sourceMap"
2018-08-20 19:38:33 +02:00
]
},
{
test: /(\.(png|jpe?g|gif)$|^((?!font).)*\.svg$)/,
loaders: [
{
loader: "file-loader",
options: {
name: loader_path => {
2018-08-29 00:47:59 +02:00
if(!/node_modules/.test(loader_path)) {
2018-08-20 19:38:33 +02:00
return "app/images/[name].[ext]?[hash]";
}
return (
"app/images/vendor/" +
loader_path.replace(/\\/g, "/")
.replace(/((.*(node_modules))|images|image|img|assets)\//g, '') +
2018-08-20 19:38:33 +02:00
'?[hash]'
);
},
}
}
]
},
{
test: /(\.(woff2?|ttf|eot|otf)$|font.*\.svg$)/,
loaders: [
{
loader: "file-loader",
options: {
name: loader_path => {
2018-08-29 00:47:59 +02:00
if (!/node_modules/.test(loader_path)) {
2018-08-20 19:38:33 +02:00
return 'app/fonts/[name].[ext]?[hash]';
}
return (
'app/fonts/vendor/' +
loader_path
2018-08-20 19:38:33 +02:00
.replace(/\\/g, '/')
.replace(/((.*(node_modules))|fonts|font|assets)\//g, '') +
2018-08-20 19:38:33 +02:00
'?[hash]'
);
},
}
}
]
}
]
2018-08-20 02:39:56 +02:00
},
performance: {
hints: false
2018-08-20 19:38:33 +02:00
},
plugins: [
new MiniCssExtractPlugin({
filename: "bundle.css"
})
]
}