Userscript template aktualisiert
This commit is contained in:
53
config/webpack.config.base.cjs
Normal file
53
config/webpack.config.base.cjs
Normal file
@@ -0,0 +1,53 @@
|
||||
const path = require('path')
|
||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
|
||||
|
||||
const webpackConfig = {
|
||||
resolve: {
|
||||
extensions: ['.js', '.ts']
|
||||
},
|
||||
optimization: {
|
||||
minimize: false,
|
||||
moduleIds: 'named',
|
||||
},
|
||||
entry: './src/index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../dist')
|
||||
},
|
||||
externals: {
|
||||
jquery: '$',
|
||||
axios: 'axios',
|
||||
'axios-userscript-adapter': 'axiosGmxhrAdapter'
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
},
|
||||
test: /\.js$/,
|
||||
},
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: 'ts-loader'
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
'css-loader',
|
||||
'less-loader', // 将 Less 编译为 CSS
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
'css-loader',
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: process.env.npm_config_report ? [new BundleAnalyzerPlugin()] : [],
|
||||
}
|
||||
|
||||
module.exports = webpackConfig
|
||||
Reference in New Issue
Block a user