mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-06 07:39:02 +02:00
[latexqc] Continue the ESM migration (#24743)
* Set `"type": "module"` in package.json * Update imports to include file extensions * Update imports to include file extensions in test files * Convert webpack files to ESM * Update configureStore.js for ESM * Make static-assets CJS, and rename with .cjs * Misc: update imports to `node:path` * Add vitest; Remove chai, mocha, sinon, expect, jsdom * Return promises in conversion-controller, to make testing easier * Update tests to vitest syntax * Fix JSON import syntax and babel config * Import combobo from NPM * Rename `app.js` to `app.cjs` This should prevent errors in the production app (https://console.cloud.google.com/cloud-build/builds;region=us-east1/8b42465c-0d07-4a08-b856-aa18c13fae46?project=overleaf-ops) ### Before ``` node@ea395ce612a8:/overleaf/services/latexqc$ node app.js [...] ReferenceError: require is not defined in ES module scope, you can use import instead This file is being treated as an ES module because it has a '.js' file extension and '/overleaf/services/latexqc/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension. at file:///overleaf/services/latexqc/app.js:2:1 at ModuleJob.run (node:internal/modules/esm/module_job:234:25) at async ModuleLoader.import (node:internal/modules/esm/loader:473:24) at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:122:5) ``` ### After ``` node@ea395ce612a8:/overleaf/services/latexqc$ node app.cjs -------------------------- ===> 😊 Starting Server . . . ===> Environment: production ===> Listening on port: 8082 -------------------------- ``` * Rename `app.js` to `app.cjs` (Fixup forgotten one) * Rename `app.js` to `app.cjs` (Fixup 2) * Rename asset files to `.js` Fixes: ``` Refused to execute script from 'https://staging-latexqc.ieee.org/assets/9d6cc24692a7f912ff06.cjs' because its MIME type ('application/octet-stream') is not executable, and strict MIME type checking is enabled. ``` GitOrigin-RevId: f0b618f7fc4062fb6bdc3779dfc5defc5f72d614
This commit is contained in:
Generated
+1086
-333
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user