2017-07-15 21:58:05 +02:00
|
|
|
const env = require('../src/config/env');
|
2017-07-22 17:34:29 +02:00
|
|
|
const StyleLintPlugin = require('stylelint-webpack-plugin');
|
2017-06-25 20:13:39 +02:00
|
|
|
|
2017-07-13 23:28:45 +02:00
|
|
|
const isDev = process.env.NODE_ENV === 'development';
|
2017-06-25 20:13:39 +02:00
|
|
|
|
2017-07-15 21:58:05 +02:00
|
|
|
module.exports = {
|
2017-07-13 23:28:45 +02:00
|
|
|
entry: `${env.SRC_ROOT}/webui/src/index.js`,
|
2017-06-25 20:13:39 +02:00
|
|
|
|
2017-07-13 23:28:45 +02:00
|
|
|
output: {
|
2017-06-25 20:13:39 +02:00
|
|
|
path: `${env.APP_ROOT}/static/`,
|
2017-07-15 21:58:05 +02:00
|
|
|
filename: '[name].[hash].js',
|
2017-06-25 20:13:39 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
resolve: {
|
2017-07-15 21:58:05 +02:00
|
|
|
extensions: ['.js', '.jsx'],
|
2017-06-25 20:13:39 +02:00
|
|
|
},
|
|
|
|
|
2017-07-22 17:34:29 +02:00
|
|
|
plugins: [
|
|
|
|
new StyleLintPlugin({
|
|
|
|
files: ['src/**/*.scss'],
|
|
|
|
failOnError: false,
|
|
|
|
emitErrors: true,
|
|
|
|
syntax: 'scss',
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
|
2017-06-25 20:13:39 +02:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
/* Pre loader */
|
|
|
|
{
|
|
|
|
enforce: 'pre',
|
2017-07-15 21:58:05 +02:00
|
|
|
test: /\.js?$/,
|
2017-06-25 20:13:39 +02:00
|
|
|
exclude: /node_modules/,
|
2017-07-15 22:04:58 +02:00
|
|
|
use: 'eslint-loader',
|
2017-06-25 20:13:39 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
/* Normal loader */
|
|
|
|
{
|
2017-07-15 21:58:05 +02:00
|
|
|
test: /\.js?$/,
|
2017-06-25 20:13:39 +02:00
|
|
|
exclude: /node_modules/,
|
2017-07-15 22:04:58 +02:00
|
|
|
use: 'babel-loader',
|
2017-06-25 20:13:39 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(jpe?g|png|gif|svg)$/,
|
2017-07-15 22:04:58 +02:00
|
|
|
use: 'file-loader?name=[name].[ext]',
|
2017-07-06 16:42:36 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(ttf|eot|woff|woff2|svg)$/,
|
|
|
|
loader: 'url-loader',
|
|
|
|
options: {
|
|
|
|
limit: 50000,
|
2017-07-15 22:04:58 +02:00
|
|
|
name: 'fonts/[hash].[ext]',
|
|
|
|
},
|
2017-06-25 20:13:39 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.scss$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: [
|
|
|
|
{
|
2017-07-15 22:04:58 +02:00
|
|
|
loader: 'style-loader',
|
2017-06-25 20:13:39 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'css-loader',
|
|
|
|
options: {
|
|
|
|
sourceMap: true,
|
|
|
|
module: true,
|
2017-07-15 22:04:58 +02:00
|
|
|
localIdentName: '[path][name]__[local]--[hash:base64:5]',
|
|
|
|
},
|
2017-06-25 20:13:39 +02:00
|
|
|
},
|
|
|
|
{
|
2017-07-15 22:04:58 +02:00
|
|
|
loader: 'sass-loader',
|
|
|
|
},
|
|
|
|
],
|
2017-07-06 16:42:36 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
|
|
|
{
|
2017-07-15 22:04:58 +02:00
|
|
|
loader: 'style-loader',
|
2017-07-06 16:42:36 +02:00
|
|
|
},
|
|
|
|
{
|
2017-07-15 22:04:58 +02:00
|
|
|
loader: 'css-loader',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2017-06-25 20:13:39 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
devtool: isDev ? 'source-map' : 'eval',
|
|
|
|
|
2017-07-15 21:58:05 +02:00
|
|
|
stats: {
|
2017-07-15 22:04:58 +02:00
|
|
|
children: false,
|
|
|
|
},
|
2017-06-25 20:13:39 +02:00
|
|
|
};
|