2018-08-20 02:33:36 +02:00
|
|
|
const path = require('path');
|
2018-08-20 19:38:33 +02:00
|
|
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
2018-08-20 02:33:36 +02:00
|
|
|
|
|
|
|
module.exports = {
|
2018-08-20 19:38:33 +02:00
|
|
|
entry: {
|
|
|
|
// js: './ui/index.js',
|
|
|
|
sass: './ui/index.scss'
|
|
|
|
},
|
2018-08-20 02:33:36 +02:00
|
|
|
output: {
|
|
|
|
filename: 'bundle.js',
|
2018-08-29 00:47:59 +02:00
|
|
|
path: path.resolve('app'),
|
|
|
|
publicPath: path.resolve('app')
|
2018-08-20 02:33:36 +02:00
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
Utilities: path.resolve(__dirname, 'ui/js/')
|
|
|
|
},
|
2018-08-24 18:52:05 +02:00
|
|
|
extensions: ['.js', '.json', '.jsx']
|
2018-08-20 02:33:36 +02:00
|
|
|
},
|
|
|
|
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: {
|
2018-08-24 18:52:05 +02:00
|
|
|
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/" +
|
2018-08-24 18:52:05 +02:00
|
|
|
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: {
|
2018-08-24 18:52:05 +02:00
|
|
|
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 (
|
2018-08-24 18:52:05 +02:00
|
|
|
'app/fonts/vendor/' +
|
|
|
|
loader_path
|
2018-08-20 19:38:33 +02:00
|
|
|
.replace(/\\/g, '/')
|
2018-08-24 18:52:05 +02:00
|
|
|
.replace(/((.*(node_modules))|fonts|font|assets)\//g, '') +
|
2018-08-20 19:38:33 +02:00
|
|
|
'?[hash]'
|
|
|
|
);
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2018-08-20 02:33:36 +02:00
|
|
|
}
|
|
|
|
]
|
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"
|
|
|
|
})
|
|
|
|
]
|
2018-08-20 02:33:36 +02:00
|
|
|
}
|