47 lines
1006 B
JavaScript
47 lines
1006 B
JavaScript
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
// Get __dirname equivalent in ESM
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
export default {
|
|
mode: 'production',
|
|
entry: {
|
|
main: './src/index.ts',
|
|
'cli-bundle': './src/cli.ts',
|
|
},
|
|
target: 'node',
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
use: 'ts-loader',
|
|
exclude: /node_modules/,
|
|
},
|
|
],
|
|
},
|
|
resolve: {
|
|
extensions: ['.tsx', '.ts', '.js', '.mjs', '.json'],
|
|
extensionAlias: {
|
|
'.js': ['.js', '.ts'],
|
|
'.mjs': ['.mjs', '.mts'],
|
|
'.cjs': ['.cjs', '.cts'],
|
|
},
|
|
// This ensures imports without file extensions still work properly
|
|
fullySpecified: false,
|
|
},
|
|
output: {
|
|
filename: '[name].js',
|
|
path: path.resolve(__dirname, 'dist'),
|
|
clean: true,
|
|
},
|
|
experiments: {
|
|
outputModule: true,
|
|
},
|
|
optimization: {
|
|
minimize: false
|
|
},
|
|
};
|
|
|