feat: init base module
This commit is contained in:
59
webpack.shell.config.cjs
Normal file
59
webpack.shell.config.cjs
Normal file
@@ -0,0 +1,59 @@
|
||||
/* eslint-disable */
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const nodeExternals = require('webpack-node-externals');
|
||||
const pkgs = require('./package.json');
|
||||
const glob = require('glob');
|
||||
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
||||
|
||||
const plugins = [new ForkTsCheckerWebpackPlugin()];
|
||||
|
||||
module.exports = {
|
||||
// mode: 'production',
|
||||
// entry: path.join(__dirname, './src/app.ts'),
|
||||
entry: glob.sync('./src/scripts/*.ts').reduce((entries, p) => {
|
||||
const name = path.basename(p, '.ts'); //获取路径的文件名 aaa/bbb.js => bbb
|
||||
return { ...entries, [name]: p };
|
||||
}, {}),
|
||||
target: 'node',
|
||||
output: {
|
||||
path: path.join(__dirname, './dist/scripts'),
|
||||
module: true,
|
||||
chunkFormat: 'module',
|
||||
},
|
||||
experiments: {
|
||||
outputModule: true,
|
||||
},
|
||||
optimization: {
|
||||
minimize: false,
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
exclude: '/node_modules/',
|
||||
use: {
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
allowTsInNodeModules: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.ts', '.js'],
|
||||
alias: {
|
||||
'@': path.join(__dirname, './src'),
|
||||
hexoid: 'hexoid/dist/index.js',
|
||||
},
|
||||
},
|
||||
externals: [
|
||||
nodeExternals({
|
||||
allowlist: ['/@abearxiong*/'],
|
||||
}),
|
||||
],
|
||||
|
||||
plugins: [...plugins],
|
||||
node: {},
|
||||
};
|
||||
Reference in New Issue
Block a user