From ec13357666bc41caa79bfa3155a98fdc2b2506d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Uhl=C3=AD=C5=99?= Date: Tue, 28 Jun 2022 12:28:53 +0200 Subject: [PATCH] build: use commonjs config for webpack (#449) --- package-lock.json | 28 -------------------------- package.json | 3 +-- webpack.config.ts => webpack.config.js | 6 +++--- 3 files changed, 4 insertions(+), 33 deletions(-) rename webpack.config.ts => webpack.config.js (91%) diff --git a/package-lock.json b/package-lock.json index 406c241..f8378b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -79,7 +79,6 @@ "babel-plugin-syntax-dynamic-import": "6.18.0", "babel-plugin-tsconfig-paths": "1.0.2", "cors": "^2.8.5", - "cross-env": "^7.0.3", "depcheck": "^1.4.3", "env-paths": "^3.0.0", "eslint": "8.17.0 ", @@ -7646,24 +7645,6 @@ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", "dev": true }, - "node_modules/cross-env": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", - "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.1" - }, - "bin": { - "cross-env": "src/bin/cross-env.js", - "cross-env-shell": "src/bin/cross-env-shell.js" - }, - "engines": { - "node": ">=10.14", - "npm": ">=6", - "yarn": ">=1" - } - }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -25945,15 +25926,6 @@ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", "dev": true }, - "cross-env": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", - "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.1" - } - }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", diff --git a/package.json b/package.json index dfbdfe7..2d3cf7b 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,6 @@ "babel-plugin-syntax-dynamic-import": "6.18.0", "babel-plugin-tsconfig-paths": "1.0.2", "cors": "^2.8.5", - "cross-env": "^7.0.3", "depcheck": "^1.4.3", "env-paths": "^3.0.0", "eslint": "8.17.0 ", @@ -127,7 +126,7 @@ "start": "react-scripts start", "desktop": "node ./desktop.mjs", "build": "react-scripts build", - "build:component": "cross-env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' webpack --mode=production", + "build:component": "webpack --mode=production", "compile:types": "tsc --project tsconfig.lib.json --emitDeclarationOnly --declaration", "test": "react-scripts test", "serve": "node ./serve.js", diff --git a/webpack.config.ts b/webpack.config.js similarity index 91% rename from webpack.config.ts rename to webpack.config.js index 19c9017..5333883 100644 --- a/webpack.config.ts +++ b/webpack.config.js @@ -1,8 +1,8 @@ -import Path from 'path' -import { Configuration } from 'webpack' +// eslint-disable-next-line @typescript-eslint/no-var-requires +const Path = require('path') // eslint-disable-next-line import/no-anonymous-default-export -export default (): Configuration => { +module.exports = () => { const entry = Path.resolve(__dirname, 'src', 'App.tsx') return {