Every time I try to run the project using this command, an error pops up:
> npm run build
npm info using <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c7a9b7aa87fee9f1e9f0">[email protected]</a>
npm info using <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4628292223063077706877726874">[email protected]</a>
npm info found workspace root at /Users/xiaoqiangjiang/source/reddwarf/frontend/codemirror-tex
> <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a1d3c58ccdc4dbc4d38cd5c4d9e1918f918f90">[email protected]</a> build
> NODE_OPTIONS='--loader ts-node/esm' gulp build
(node:82873) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
CustomError: Cannot find module '/Users/xiaoqiangjiang/source/reddwarf/frontend/codemirror-tex/packages/lezer-tex/src/utils/lzw' imported from /Users/xiaoqiangjiang/source/reddwarf/frontend/codemirror-tex/packages/lezer-tex/gulpfile.ts
at finalizeResolution (/Users/xiaoqiangjiang/source/reddwarf/frontend/codemirror-tex/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:366:11)
at moduleResolve (/Users/xiaoqiangjiang/source/reddwarf/frontend/codemirror-tex/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:801:10)
at Object.defaultResolve (/Users/xiaoqiangjiang/source/reddwarf/frontend/codemirror-tex/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:912:11)
at /Users/xiaoqiangjiang/source/reddwarf/frontend/codemirror-tex/node_modules/ts-node/src/esm.ts:218:35
at entrypointFallback (/Users/xiaoqiangjiang/source/reddwarf/frontend/codemirror-tex/node_modules/ts-node/src/esm.ts:168:34)
at /Users/xiaoqiangjiang/source/reddwarf/frontend/codemirror-tex/node_modules/ts-node/src/esm.ts:217:14
at addShortCircuitFlag (/Users/xiaoqiangjiang/source/reddwarf/frontend/codemirror-tex/node_modules/ts-node/src/esm.ts:409:21)
at resolve (/Users/xiaoqiangjiang/source/reddwarf/frontend/codemirror-tex/node_modules/ts-node/src/esm.ts:197:12)
at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
npm ERR! Lifecycle script `build` failed with error:
npm ERR! Error: command failed
npm ERR! in workspace: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1f6d7b32737a657a6d326b7a675f2f31119f3e3e33">[email protected]</a>
npm ERR! at location: /Users/xiaoqiangjiang/source/reddwarf/frontend/codemirror-tex/packages/lezer-tex
The issue seems to be that the build process is not recognizing the .ts file type. What could have caused this? Below you can find the package.json:
{
"name": "rd-lezer-tex",
"version": "0.0.1",
"description": "lezer-based TeX grammar",
"keywords": [
"lezer",
"tex",
"cm",
"codemirror",
"codemirror6",
"cm6",
"latex",
"grammar",
"language"
],
"author": "mu.io <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cbafaebd8ba6aabfa3aea6aabfa2a8e5a2a4">[email protected]</a>>",
"homepage": "https://github.com/mu-io/codemirror-tex",
"license": "GPL-3.0-or-later",
"main": "./lib/index.cjs",
"module": "./lib/index.js",
"types": "./lib/index.d.ts",
"type": "module",
"exports": {
"import": "./lib/index.js",
"require": "./lib/index.cjs"
},
"files": [
"lib"
],
"directories": {
"lib": "lib",
"test": "tests"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/mu-io/codemirror-tex.git"
},
...
In addition, here is the content of the tsconfig.json
:
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": ["src/*"]
},
"module": "ESNext",
"rootDir": ".",
"allowJs": true
},
"ts-node": {
"esm": true
},
"include": ["src", "tests", "third_party"]
}
I made sure that the import file exists and the import style matches this pattern:
import { lzwEncode } from './src/utils/lzw';
.