0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00
verdaccio/tools/webpack.config.js

95 lines
1.8 KiB
JavaScript
Raw Normal View History

const env = require('../src/config/env');
const StyleLintPlugin = require('stylelint-webpack-plugin');
const isDev = process.env.NODE_ENV === 'development';
module.exports = {
entry: `${env.SRC_ROOT}/webui/src/index.js`,
output: {
path: `${env.APP_ROOT}/static/`,
filename: '[name].[hash].js',
},
resolve: {
extensions: ['.js', '.jsx'],
},
plugins: [
new StyleLintPlugin({
files: ['src/**/*.scss'],
failOnError: false,
emitErrors: true,
syntax: 'scss',
}),
],
module: {
rules: [
/* Pre loader */
{
enforce: 'pre',
test: /\.jsx?$/,
exclude: /node_modules/,
2017-07-15 15:04:58 -05:00
use: 'eslint-loader',
},
/* Normal loader */
{
test: /\.jsx?$/,
exclude: /node_modules/,
2017-07-15 15:04:58 -05:00
use: 'babel-loader',
},
{
test: /\.(jpe?g|png|gif|svg)$/,
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]',
},
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: [
{
2017-07-15 15:04:58 -05:00
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
sourceMap: true,
module: true,
2017-07-15 15:04:58 -05:00
localIdentName: '[path][name]__[local]--[hash:base64:5]',
},
},
{
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',
},
],
},
],
},
devtool: isDev ? 'source-map' : false,
stats: {
2017-07-15 15:04:58 -05:00
children: false,
},
};