Closed DmitriyVdE closed 2 months ago
Other dev reported strange issue with fast-serve and pnpm versioning. Could you run pnpm list spfx-fast-serve-helpers
and tell me the installed version? If, for some reason, version is 1.18.0, please run pnpm install spfx-fast-serve-helpers@latest -DE
and make sure that the installed version is 1.18.12 and try to run your project.
Also, common advice when such kind of problems happen would be completely deleting node_modules, pnpm lock file and reinstalling all dependencies, if not done before.
Hi, thank you for responding
I ran the pnpm list spfx-fast-serve-helpers
command and got the following output:
devDependencies:
spfx-fast-serve-helpers 1.18.12
I tried reverting to 1.18.2
, this did not work, and I also tried your suggestion and ran pnpm install spfx-fast-serve-helpers@latest -DE
which set the version to 1.18.12
which also did not solve the issue. I also checked in the root of the mono repo, and the version there is also 1.18.12
.
I have removed the node_modules
folder and the lock file multiple times. I also updated my node to 18.20.2
and made sure my pnpm store/cached packages etc. was completely empty before running pnpm i
so as to make sure there were no corrupt/outdated packages.
Are there maybe other files I have to check that could cause this issue?
I managed to reproduce the problem in a clean webpart.
Because of some react types versioning issues, we had to add the following to our tsconfig.json
under the compilerOptions
:
"paths": {
"react": [
"./node_modules/@types/react"
],
"react-dom": [
"./node_modules/@types/react-dom"
],
}
Once this is added, fast-serve throws the error.
The versions installed are the following:
"@types/react": "17.0.45",
"@types/react-dom": "17.0.25",
I did some more testing and when only leaving the following elements in the tsconfig.json
it works:
"paths": {
"react": [
"./node_modules/@types/react"
]
}
So it seems the @types/react-dom
reference was causing this. I'm not sure if the version (17.0.25
) was the cause, but since we don't need it we'll just leave it out.
My colleague noticed the trailing comma after the @types/react-dom
entry in the paths
property and asked me to remove it. Which solved the issue. It's strange that I wasn't getting any linting errors for this specifically, and my linter was also not removing it.
Apparently, there's an exception for 'tsconfig.json' that allows trailing commas, so it probably has to do with how fast-serve
parses the tsconfig.json
files.
Glad it finally resolved.
Apparently, there's an exception for 'tsconfig.json' that allows trailing commas, so it probably has to do with how
fast-serve
parses thetsconfig.json
files.
Yeah.. you're right, fast-serve
uses require
to load some configs, which is stricter to the json format. I will check if I could fix it.
JFYI I published spfx-fast-serve-helpers@1.18.13
, which is more relaxed to tsconfig.json
and allows extra commas, comments and some other things in TS config file. Please try it, I will close the issue, please reopen if there are still some problems.
Hi
I'm currently having an issue I can't seem to find the cause of.
Some info before the explanation:
gulp serve
tsconfig.json
with some centralized files (Which can be found below) with files imported from other packages within the monorepo.gulpfile.js
andfast-serve/webpack.extend.json
contain configuration to add support for.mjs
and setfs: "empty"
along with some other simple scripts that don't cause problems in other webpartsWhen using fast-serve, I'm getting the following error:
package.json
for the webpart:tsconfig.json
for the webpart:extends (from another monorepo package):
and extends (within the same monorepo package as the extends above):
package.json
for the monorepo package with the above extends files: