This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
const path = require('path');
module.exports = {
entry: './module/index.js',
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'webpack_dist'),
library: {
type: 'module', // 重要:确保使用ES模块格式
},
// 打包其他第三方node包的时候可以使用这种
// library: 'MyLibrary',
// libraryTarget: 'commonjs',
mode: 'production',
experiments: {
outputModule: true, // 启用ES模块输出
optimization: {
usedExports: true,
};