diff --git a/package.json b/package.json index 6bf56cab8..4c5e0a029 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "build-backend-docs": "rimraf ./docs/backend_api && ./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/backend_api src/becca/entities/*.js src/services/backend_script_api.js src/services/sql.js", "build-frontend-docs": "rimraf ./docs/frontend_api && ./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/frontend_api src/public/app/entities/*.js src/public/app/services/frontend_script_api.js src/public/app/widgets/basic_widget.js src/public/app/widgets/note_context_aware_widget.js src/public/app/widgets/right_panel_widget.js", "build-docs": "npm run build-backend-docs && npm run build-frontend-docs", - "webpack": "webpack -c webpack.config.ts", + "webpack": "cross-env NODE_OPTIONS=--loader=ts-node/esm webpack -c webpack.config.ts", "test-jasmine": "cross-env TRILIUM_DATA_DIR=./data-test tsx ./node_modules/.bin/jasmine", "test-es6": "tsx -r esm spec-es6/attribute_parser.spec.ts", "test": "npm run test-jasmine && npm run test-es6", diff --git a/src/services/asset_path.ts b/src/services/asset_path.ts index 72a21fdb9..ffb88f626 100644 --- a/src/services/asset_path.ts +++ b/src/services/asset_path.ts @@ -1,3 +1,3 @@ -import packageJson from "../../package.json"; +import packageJson from "../../package.json" assert { type: "json" }; export default `assets/v${packageJson.version}`; diff --git a/tsconfig.json b/tsconfig.json index ee57f1130..5898cb05d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "moduleResolution": "Bundler", - "module": "ES2022", + "module": "ESNext", "target": "ES2020", "declaration": false, "sourceMap": true, diff --git a/webpack.config.ts b/webpack.config.ts index 1c67bbe84..30293de06 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -1,7 +1,9 @@ +import { fileURLToPath } from "url"; import path from "path"; import assetPath from "./src/services/asset_path.js"; -module.exports = { +const rootDir = path.dirname(fileURLToPath(import.meta.url)); +export default { mode: 'production', entry: { setup: './src/public/app/setup.js', @@ -10,7 +12,7 @@ module.exports = { }, output: { publicPath: `${assetPath}/app-dist/`, - path: path.resolve(__dirname, 'src/public/app-dist'), + path: path.resolve(rootDir, 'src/public/app-dist'), filename: '[name].js', }, devtool: 'source-map',