From 4e97e5e86a9d058576005c6f7d6f81ee23d7d167 Mon Sep 17 00:00:00 2001 From: David Reed Date: Mon, 12 Sep 2022 20:10:21 -0400 Subject: [PATCH] updae script --- webpack.config.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 077b148..ae3419f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,16 +1,22 @@ -import webpack from "webpack"; -import path from "path"; +import webpack from 'webpack'; +import { fileURLToPath } from 'url'; -const __dirname = path.resolve(path.dirname(decodeURI(new URL(import.meta.url).pathname))).slice(3); +const isDevelopment = process.env.NODE_ENV !== 'production'; -console.log(path.resolve(path.dirname(decodeURI(new URL(import.meta.url).pathname))), __dirname); +/** + * @type {webpack.Configuration} + */ +const config = { + mode: isDevelopment ? 'development' : 'production', + entry: fileURLToPath(new URL('./rewrite/index.js', import.meta.url)), + output: { + path: fileURLToPath(new URL('./lib/', import.meta.url)), + filename: 'uv.bundle.js', + }, + performance: { + // suppress "entrypoint size limit" warning + hints: false, + }, +}; -webpack({ - entry: path.join(__dirname, './rewrite/index.js'), - output: { - path: __dirname, - filename: './lib/uv.bundle.js', - } -}, (err, i) => - console.log(!err ? 'Ultraviolet bundled!' : e) -); \ No newline at end of file +export default config;