-
-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Hi Lukas - great rework with a great API, congrats. I tried to import this in my React / TS project and it would only work when i remove the "type": "module" in project.json. Otherwise it gives me
ERROR in ../../node_modules/@headless-tree/core/lib/esm/index.js 28:0-45 Module not found: Error: Can't resolve './core/build-static-instance' in 'C:\Users\andreashe\Documents\Development\InSystem\node_modules\@headless-tree\core\lib\esm' Did you mean 'build-static-instance.js'? BREAKING CHANGE: The request './core/build-static-instance' failed to resolve only because it was resolved as fully specified (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request. @ ./src/components/Organization/Organization.tsx 8:0-118 101:15-36 101:38-54 101:56-74 101:76-94 @ ./src/components/HomeGrid/HomeGrid.tsx 28:0-60 105:44-56 @ ./src/components/Baseplate/Baseplate.tsx 25:0-48 195:58-66 198:17-25 @ ./src/components/Baseplate/index.tsx 4:0-28 4:0-28 @ ./src/App.tsx 21:0-51 47:612-621 @ ./src/index.tsx 8:0-24 16:102-105
It basically seems to require ".js" extensions in the imports with "type"="module".
My own project.json is as follows:
{ "name": "@globe/client", "version": "0.1.0", "private": true, "sideeffects": false, "main": "src/index.tsx", "type": "module", "scripts": { "version:bump": "npm run version:bump", "version:patch": "npm version patch", "start": "webpack serve --config webpack/webpack.dev.cjs", "build": "webpack --config webpack/webpack.prod.cjs", "build.standalone": "webpack --config webpack/webpack.prod.standalone.cjs", "build:cdn": "webpack --config webpack/webpack.prod.cdn.cjs", "extract:texts": "formatjs extract --ignore ./src/**/*.d.ts --out-file ./lang/dev.json --id-interpolation-pattern [sha512:contenthash:base64:6] ./src/**/*.{ts,tsx}", "sync:texts": "node ./sync_messages.cjs ./lang", "compile:texts": "formatjs compile-folder ./lang ./src/assets/lang && rimraf ./src/assets/lang/dev.json" }, "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] }, "dependencies": { "@blueprintjs/core": "^5.19.0", "@blueprintjs/docs-theme": "^5.3.32", "@blueprintjs/select": "^5.3.20", ... "react": "^18.3.1", "react-chartjs-2": "^5.3.0", "react-dom": "^18.3.1", "react-grid-layout": "^1.5.0", "react-hook-form": "^7.56.1", "react-intl": "^6.7.0", "react-router-dom": "^7.5.1", "react-select": "^5.10.0", "react-table": "^7.8.0", "sanitize-filename": "^1.6.3", "slate": "^0.112.0", "slate-history": "^0.113.1", "slate-react": "^0.112.1", "styled-components": "^6.1.17", "uuid": "^10.0.0", "websocket": "^1.0.35" }, "devDependencies": { "@babel/preset-env": "^7.26.9", "@babel/preset-react": "^7.26.3", "@babel/preset-typescript": "^7.27.0", "@formatjs/cli": "^6.6.4", "@formatjs/ts-transformer": "^3.13.34", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.16", "@types/country-flag-icons": "^1.2.2", "@types/d3": "^7.4.3", "@types/d3-graphviz": "^2.6.10", "@types/file-saver": "^2.0.7", ... "style-loader": "^4.0.0", "ts-loader": "^9.5.1", "webpack": "^5.99.6", "webpack-cli": "^6.0.1", "webpack-dev-server": "^5.2.1", "webpack-merge": "^6.0.1" } }