mirror of
https://github.com/woodchen-ink/clash-and-dashboard.git
synced 2025-07-18 05:51:56 +08:00
57 lines
1.7 KiB
JavaScript
57 lines
1.7 KiB
JavaScript
// shared config (dev and prod)
|
|
const { resolve } = require('path')
|
|
const { CheckerPlugin } = require('awesome-typescript-loader')
|
|
const StyleLintPlugin = require('stylelint-webpack-plugin')
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
|
|
module.exports = {
|
|
resolve: {
|
|
extensions: ['.ts', '.tsx', '.js', '.jsx'],
|
|
},
|
|
context: resolve(__dirname, '../../src'),
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.js$/,
|
|
use: ['babel-loader', 'source-map-loader'],
|
|
exclude: /node_modules/,
|
|
},
|
|
{
|
|
test: /\.tsx?$/,
|
|
use: ['babel-loader', 'awesome-typescript-loader'],
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: ['style-loader', { loader: 'css-loader', options: { importLoaders: 1 } }],
|
|
},
|
|
{
|
|
test: /\.scss$/,
|
|
loaders: [
|
|
'style-loader',
|
|
{ loader: 'css-loader', options: { importLoaders: 1 } },
|
|
'sass-loader',
|
|
],
|
|
},
|
|
{
|
|
test: /\.(jpe?g|png|gif|svg)$/i,
|
|
loaders: [
|
|
'file-loader?hash=sha512&digest=hex&name=img/[hash].[ext]',
|
|
'image-webpack-loader?bypassOnDebug&optipng.optimizationLevel=7&gifsicle.interlaced=false',
|
|
],
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new CheckerPlugin(),
|
|
new StyleLintPlugin(),
|
|
new HtmlWebpackPlugin({ template: 'index.html.ejs', }),
|
|
],
|
|
externals: {
|
|
'react': 'React',
|
|
'react-dom': 'ReactDOM',
|
|
},
|
|
performance: {
|
|
hints: false,
|
|
},
|
|
}
|