const path = require('path'); const htmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { mode: 'development', name: 'yhdesigner-userDefineModule', entry: { "designer": './src/index.ts', "preview": './src/preview.ts' }, output: { globalObject: 'self', filename: '[name].js', path: path.resolve(__dirname, './dist') }, module: { unknownContextCritical: false, rules: [ { test: /\.tsx?$/, use: ['ts-loader'], exclude: /node_modules/ }, { test: /\.css$/, use: ['style-loader', 'css-loader'] }, { test: /\.less$/, use: ['style-loader', 'css-loader', 'less-loader'] }, { test: /\.(gif|png|jpeg|eot|woff|ttf|svg|pdf)$/, use: ['file-loader'] } ] }, resolve: { extensions: ['.tsx', '.ts', ".js",], alias: { 'vue$': 'vue/dist/vue.esm.js' } }, externals: { jquery: "$", lodash: "_", echarts: "echarts", }, plugins: [ new htmlWebpackPlugin({ template: './src/index.html', filename: 'index.html', inject: 'body', chunks: ['designer'] }), new htmlWebpackPlugin({ template: './src/preview.html', filename: 'preview.html', inject: 'body', chunks: ['preview'] }), ] }