1
0
mirror of https://github.com/SomboChea/ui synced 2024-12-26 22:24:26 +07:00
verdaccio-ui/tools/webpack.config.js

98 lines
1.9 KiB
JavaScript
Raw Normal View History

2019-04-05 02:23:40 +07:00
const env = require('../src/config/env');
const StyleLintPlugin = require('stylelint-webpack-plugin');
2019-02-03 17:23:33 +07:00
module.exports = {
2019-04-05 02:23:40 +07:00
entry: `${env.SRC_ROOT}/webui/src/index.js`,
2019-02-03 17:23:33 +07:00
output: {
2019-04-05 02:23:40 +07:00
path: `${env.APP_ROOT}/static/`,
filename: '[name].[hash].js',
// FIXME: do we need this?
2019-04-05 02:23:40 +07:00
publicPath: 'ToReplaceByVerdaccio/-/static',
2019-02-03 17:23:33 +07:00
},
resolve: {
2019-04-05 02:23:40 +07:00
extensions: ['.js', '.jsx'],
2019-02-03 17:23:33 +07:00
},
plugins: [
new StyleLintPlugin({
2019-04-05 02:23:40 +07:00
files: ['src/webui/**/styles.js'],
2019-02-03 17:23:33 +07:00
failOnError: false,
emitErrors: true
2019-04-05 02:23:40 +07:00
}),
2019-02-03 17:23:33 +07:00
],
optimization: {
runtimeChunk: {
2019-04-05 02:23:40 +07:00
name: 'manifest',
2019-02-03 17:23:33 +07:00
},
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
2019-04-05 02:23:40 +07:00
name: 'vendors',
2019-02-03 17:23:33 +07:00
priority: -20,
2019-04-05 02:23:40 +07:00
chunks: 'all',
},
},
},
2019-02-03 17:23:33 +07:00
},
module: {
rules: [
2019-04-05 02:23:40 +07:00
/* Pre loader */
{
enforce: 'pre',
test: /\.jsx?$/,
exclude: /node_modules/,
use: 'eslint-loader',
},
2019-02-03 17:23:33 +07:00
/* Normal loader */
{
test: /\.jsx?$/,
exclude: /node_modules/,
2019-04-05 02:23:40 +07:00
use: 'babel-loader',
2019-02-03 17:23:33 +07:00
},
{
test: /\.(jpe?g|png|gif|svg)$/,
use: [
{
2019-04-05 02:23:40 +07:00
loader: 'file-loader'
},
2019-02-03 17:23:33 +07:00
]
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
2019-04-05 02:23:40 +07:00
loader: 'url-loader',
2019-02-03 17:23:33 +07:00
options: {
2019-04-05 02:23:40 +07:00
name: 'fonts/[name].[ext]',
limit: 50,
},
2019-02-03 17:23:33 +07:00
},
{
test: /\.scss$/,
exclude: /node_modules/,
loader: `style-loader!css-loader?module&sourceMap=false&localIdentName=[path][name]__[local]--[hash:base64:5]
!resolve-url-loader?keepQuery!sass-loader?sourceMap`
},
{
test: /\.css$/,
use: [
{
2019-04-05 02:23:40 +07:00
loader: 'style-loader',
2019-02-03 17:23:33 +07:00
},
{
2019-04-05 02:23:40 +07:00
loader: 'css-loader',
},
],
},
],
2019-02-03 17:23:33 +07:00
},
stats: {
2019-04-05 02:23:40 +07:00
children: false,
},
2019-02-03 17:23:33 +07:00
};