1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/packages/plugins/ui-theme/tools/webpack.config.js

111 lines
2.1 KiB
JavaScript
Raw Normal View History

const StyleLintPlugin = require('stylelint-webpack-plugin');
const env = require('../config/env');
module.exports = {
entry: `${env.SRC_ROOT}/index.tsx`,
output: {
path: `${env.APP_ROOT}/static/`,
filename: '[name].[fullhash].js',
publicPath: '/-/static/',
},
resolve: {
extensions: ['.wasm', '.mjs', '.js', '.jsx', '.ts', '.tsx'],
modules: ['node_modules'],
alias: {
'verdaccio-ui/components': `${env.SRC_ROOT}/components`,
'verdaccio-ui/design-tokens': `${env.SRC_ROOT}/design-tokens`,
'verdaccio-ui/utils': `${env.SRC_ROOT}/utils`,
},
},
plugins: [
new StyleLintPlugin({
files: ['src/**/styles.ts'],
failOnError: false,
emitErrors: true,
}),
],
optimization: {
runtimeChunk: {
name: 'runtime',
},
splitChunks: {
chunks: 'all',
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'initial',
},
},
},
},
module: {
rules: [
/* Pre loader */
{
enforce: 'pre',
test: /\.jsx?$/,
exclude: /node_modules/,
use: 'eslint-loader',
},
/* Normal loader */
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: 'babel-loader',
},
{
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
},
{
test: /\.(jpe?g|png|gif|svg)$/,
use: [
{
loader: 'file-loader',
},
],
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
loader: 'url-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts',
limit: 50,
},
},
{
test: /\.css$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
},
],
},
/* Typescript loader */
{
test: /\.tsx?$/,
use: 'babel-loader',
exclude: /node_modules/,
},
],
},
stats: {
children: false,
},
};