mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	build: Fix running webpack on ESM
This commit is contained in:
		| @@ -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", | ||||
|   | ||||
| @@ -1,3 +1,3 @@ | ||||
| import packageJson from "../../package.json"; | ||||
| import packageJson from "../../package.json" assert { type: "json" }; | ||||
|  | ||||
| export default `assets/v${packageJson.version}`; | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| { | ||||
| 	"compilerOptions": { | ||||
|       "moduleResolution": "Bundler", | ||||
| 	  "module": "ES2022", | ||||
| 	  "module": "ESNext", | ||||
| 	  "target": "ES2020", | ||||
| 	  "declaration": false, | ||||
| 	  "sourceMap": true, | ||||
|   | ||||
| @@ -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', | ||||
|   | ||||
		Reference in New Issue
	
	Block a user