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