From a00e4c1aa4c06937a6967a53127933345abe7fc9 Mon Sep 17 00:00:00 2001 From: SimonShiki Date: Sun, 17 Mar 2024 11:27:18 +0000 Subject: [PATCH] :sparkles: feat: add charlotte build Signed-off-by: SimonShiki --- webpack.config.js | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 8ade6f4..4409bca 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -6,7 +6,7 @@ const { includeURLs } = require('./generate-helper'); const packageJSON = require('./package.json'); const process = require('node:process'); -const base = { +const standalone = { mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', entry: './src/index.ts', output: { @@ -74,4 +74,28 @@ const base = { ] }; -module.exports = base; +const charlotte = { + mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', + target: 'web', + entry: './src/injector/inject.ts', + experiments: { + outputModule: true + }, + output: { + library: { + type: 'module' + }, + path: path.resolve(__dirname, 'dist'), + publicPath: './', + filename: 'eureka-charlotte.js' + }, + resolve: standalone.resolve, + module: standalone.module, + plugins: [ + new webpack.DefinePlugin({ + __EUREKA_VERSION__: JSON.stringify(packageJSON.version) + }) + ] +} + +module.exports = [standalone, charlotte];