From 66a864560c28026a608f365aefb1f05fc44127cd Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Thu, 19 Oct 2023 19:21:09 -0700 Subject: [PATCH] Revert "build: revert to JS webpack config" This reverts commit b66d88434edd41ecbb80a61ad4aeb4540d9c8299. --- tsconfig.json | 7 ++++++- webpack.config.js => webpack.config.ts | 18 +++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) rename webpack.config.js => webpack.config.ts (88%) diff --git a/tsconfig.json b/tsconfig.json index 692ccd2c..a85ca80a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,5 +17,10 @@ }, "vueCompilerOptions": { "target": 2.7 - } + }, + "ts-node": { + "compilerOptions": { + "module": "CommonJS", + } + }, } \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.ts similarity index 88% rename from webpack.config.js rename to webpack.config.ts index ad3760af..42c91fc2 100644 --- a/webpack.config.js +++ b/webpack.config.ts @@ -1,13 +1,13 @@ -const webpack = require('webpack'); -const path = require('path'); +import webpack from 'webpack'; +import path from 'path'; -const WorkboxPlugin = require('workbox-webpack-plugin'); -const TerserPlugin = require('terser-webpack-plugin'); -const NodePolyfillPlugin = require('node-polyfill-webpack-plugin'); -const { VueLoaderPlugin } = require('vue-loader'); +import WorkboxPlugin from 'workbox-webpack-plugin'; +import TerserPlugin from 'terser-webpack-plugin'; +import NodePolyfillPlugin from 'node-polyfill-webpack-plugin'; +import { VueLoaderPlugin } from 'vue-loader'; -const appName = process.env.npm_package_name; -const appVersion = process.env.npm_package_version; +const appName = process.env.npm_package_name!; +const appVersion = process.env.npm_package_version!; const buildMode = process.env.NODE_ENV; const isDev = buildMode === 'development'; console.info('Building', appName, appVersion, '\n'); @@ -38,7 +38,7 @@ module.exports = { // Make sure sourcemaps have a proper path and do not // leak local paths https://github.com/webpack/webpack/issues/3603 devtoolNamespace: appName, - devtoolModuleFilenameTemplate(info) { + devtoolModuleFilenameTemplate(info: any) { const rootDir = process.cwd(); const rel = path.relative(rootDir, info.absoluteResourcePath); return `webpack:///${appName}/${rel}`;