1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01: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: /\.js?$/,
exclude: /node_modules/,
2017-07-15 22:04:58 +02:00
use: 'eslint-loader',
},
/* Normal loader */
{
test: /\.js?$/,
exclude: /node_modules/,
2017-07-15 22:04:58 +02:00
use: 'babel-loader',
},
{
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]',
},
},
{
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',
},
],
},
],
},
devtool: isDev ? 'source-map' : 'eval',
stats: {
2017-07-15 22:04:58 +02:00
children: false,
},
};