verdaccio/tools/webpack.config.js

112 lines
2.1 KiB
JavaScript
Raw Normal View History

const env = require('../src/config/env');
const StyleLintPlugin = require('stylelint-webpack-plugin');
module.exports = {
entry: `${env.SRC_ROOT}/webui/src/index.js`,
output: {
path: `${env.APP_ROOT}/static/`,
filename: '[name].[hash].js',
publicPath: 'ToReplaceByVerdaccio/-/static',
},
resolve: {
extensions: ['.js', '.jsx'],
},
plugins: [
new StyleLintPlugin({
files: ['src/**/*.scss'],
failOnError: false,
emitErrors: true,
syntax: 'scss',
}),
],
optimization: {
runtimeChunk: {
name: 'manifest',
},
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
priority: -20,
chunks: 'all',
},
},
},
},
module: {
rules: [
/* Pre loader */
{
enforce: 'pre',
test: /\.jsx?$/,
exclude: /node_modules/,
2017-07-15 22:04:58 +02:00
use: 'eslint-loader',
},
/* Normal loader */
{
test: /\.jsx?$/,
exclude: /node_modules/,
2017-07-15 22:04:58 +02:00
use: 'babel-loader',
},
{
test: /\.(jpe?g|png|gif|svg)$/,
use: [
{
loader: 'file-loader'
},
]
2017-07-06 16:42:36 +02:00
},
{
test: /\.(ttf|eot|woff|woff2)$/,
2017-07-06 16:42:36 +02:00
loader: 'url-loader',
options: {
limit: 50000,
2017-07-15 22:04:58 +02:00
name: 'fonts/[hash].[ext]',
},
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: [
{
2017-07-15 22:04:58 +02:00
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
sourceMap: true,
module: true,
2017-07-15 22:04:58 +02:00
localIdentName: '[path][name]__[local]--[hash:base64:5]',
},
},
{
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',
},
],
},
],
},
stats: {
2017-07-15 22:04:58 +02:00
children: false,
},
};