I have multiple entry points in my webpack config and I want each entry point to bundle into its own folder with nothing
import path from 'path';
import webpack from 'webpack';
import TerserPlugin from 'terser-webpack-plugin';
// Entry files
const entries = {
graphql: './src/entry/entry1.ts',
paypalPayment: './src/entry/entry2.ts',
stripePayment: './src/entry/entry3.ts',
};
export default {
mode: 'production',
entry: entries,
target: 'node',
output: {
filename: '[name]/index.js',
path: path.resolve(process.cwd(), 'dist'),
libraryTarget: 'commonjs2',
clean: true,
},
optimization: {
splitChunks: false,
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
format: {
comments: false,
}
},
extractComments: false,
})
]
},
resolve: {
extensions: ['.ts', '.js'],
extensionAlias: {
'.js': ['.ts', '.js'],
'.mjs': ['.mts', '.mjs'],
},
},
module: {
rules: [
{
test: /.ts$/,
use: {
loader: 'ts-loader',
options: {
configFile: path.resolve('tsconfig.json'),
},
},
exclude: /node_modules/,
},
],
},
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),
],
};
I can’t get it to not generate a folder with a chunk in addition to the entry folders. I want all the code to sit inside the entry files so they are standalone, how can I disable these chunks, I’ve tried a lot of different options with split chunks