/ webpack.config.js
webpack.config.js
1 const path = require('path'); 2 const nodeExternals = require('webpack-node-externals'); 3 const DeclarationBundlerPlugin = require('declaration-bundler-webpack-plugin'); 4 const webpack = require('webpack'); 5 6 const distPath = path.resolve(__dirname, './dist'); 7 8 module.exports = { 9 entry: { 10 core: './src/core/index.ts', 11 }, 12 output: { 13 filename: '[name]/index.js', 14 path: distPath, 15 }, 16 mode: 'production', 17 externals: [nodeExternals()], 18 module: { 19 rules: [ 20 { 21 test: /\.tsx?$/, 22 use: 'ts-loader', 23 exclude: /node_modules/, 24 }, 25 ], 26 }, 27 target: 'node', 28 resolve: { 29 alias: { 30 '@app': path.resolve(__dirname, './src'), 31 }, 32 extensions: ['.ts', '.js'], 33 }, 34 plugins: [ 35 new DeclarationBundlerPlugin({ 36 moduleName: '[name]', 37 out: path.resolve(distPath, '[name]'), 38 }), 39 // new webpack.BannerPlugin({ banner: '#!/usr/bin/env node', raw: true }), 40 ], 41 };