feat: init base module
This commit is contained in:
71
webpack.config.cjs
Normal file
71
webpack.config.cjs
Normal file
@@ -0,0 +1,71 @@
|
||||
/* eslint-disable */
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
// const nodeExternals = require('webpack-node-externals');
|
||||
const pkgs = require('./package.json');
|
||||
const CopyPlugin = require('copy-webpack-plugin');
|
||||
/** 解决esmodule中noEmit报错问题 */
|
||||
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
||||
|
||||
const ENV = process.env.ENV;
|
||||
|
||||
const plugins = [
|
||||
new ForkTsCheckerWebpackPlugin(),
|
||||
];
|
||||
if (ENV === 'init') {
|
||||
plugins.push(
|
||||
new CopyPlugin({
|
||||
patterns: [{ from: 'src/app.config.json5', to: 'app.config.json5' }],
|
||||
}),
|
||||
);
|
||||
}
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: path.join(__dirname, './src/app.ts'),
|
||||
target: 'node',
|
||||
// devtool: 'source-map',
|
||||
output: {
|
||||
path: path.join(__dirname, './dist'),
|
||||
// path: path.join(__dirname, './dev-package'),
|
||||
// filename: 'app.mjs',
|
||||
filename: 'app.cjs',
|
||||
// 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(),
|
||||
// ],
|
||||
externals: {
|
||||
sequelize: 'commonjs sequelize',
|
||||
'socket.io': 'commonjs socket.io',
|
||||
},
|
||||
plugins: [...plugins],
|
||||
node: {},
|
||||
};
|
||||
Reference in New Issue
Block a user