Open asyncguo opened 1 year ago
I'm having the same issue with yarn berry.
Also have had this problem for a bit but just got to creating a reproduction.
When using the src
dir, this happens with either a background/index.ts
or background.ts
structure. When using the non-src
default structure, it seems to only happen when using background/index.ts
but works when using background.ts
.
plasmo build --verbose
:
π‘ 0 | Running command: build
π£ Plasmo v0.83.0
π΄ The Browser Extension Framework
π΅ INFO | Prepare to bundle the extension...
π‘ 1 | Creating Manifest Factory...
π‘ 2 | Ensure exists: /project/home/zweihander-main/workspace/.plasmo
π‘ 3 | Plasmo version file not found, busting cache...
π‘ 4 | /project/home/zweihander-main/workspace/assets/icon.png found, creating resized icons
π‘ 5 | Creating static templates for popup
π‘ 6 | Creating static templates for options
π‘ 7 | Creating static templates for newtab
π‘ 8 | Creating static templates for devtools
π‘ 9 | Creating static templates for sidepanel
π‘ 10 | { messageHandlerList: [], portHandlerList: [] }
π‘ 11 | Creating BGSW entry
π‘ 12 | Hash changed, updating manifest
π΅ INFO | Loaded environment variables from: []
π‘ 0 | Reinitializing remote cache directory
π‘ 0 | @plasmohq/parcel-transformer-manifest
π‘ 1 | Adding icons
π‘ 2 | Adding default_icon
π‘ 3 | Handling background scripts
π‘ 4 | Handling background service worker
π΄ ERROR | Failed to resolve '../../../background/index' from './.plasmo/static/background/index.ts'
π‘ 13 | undefined
π΄ EXIT | π Good bye and have a great day!
OS: Arch Linux 6.4.12
Update: cracked it on my end. On both the repro above and my own project, the package.json
had a "main": "index.js"
line which when removed, eliminated the problem.
I think it's either the main
field that @Zweihander-Main got (which made the repo a cjs project). The other is that you might need to check and fix the tsconfig path :-?..
Also try cleaning up the .plasmo
dir and re-build.
In my case, the problem was that I had engines.node
in my package.json
set like this:
"engines": {
"node": ">=18"
}
And there is an issue in parcel-bundler describing this exact problem: https://github.com/parcel-bundler/parcel/issues/7636#issuecomment-1059401129
So I just had to add the target
to my package.json
, so it works like this:
"engines": {
"node": ">=18"
},
"targets": {
"default": {
"engines": {
"browsers": "last 2 versions, not dead, > 0.2%"
}
}
}
In my case, the problem was that I had
engines.node
in mypackage.json
set like this:"engines": { "node": ">=18" }
And there is an issue in parcel-bundler describing this exact problem: parcel-bundler/parcel#7636 (comment)
So I just had to add the
target
to mypackage.json
, so it works like this:"engines": { "node": ">=18" }, "targets": { "default": { "engines": { "browsers": "last 2 versions, not dead, > 0.2%" } } }
me too
In my case, the problem was that I had
engines.node
in mypackage.json
set like this:"engines": { "node": ">=18" }
And there is an issue in parcel-bundler describing this exact problem: parcel-bundler/parcel#7636 (comment)
So I just had to add the
target
to mypackage.json
, so it works like this:"engines": { "node": ">=18" }, "targets": { "default": { "engines": { "browsers": "last 2 versions, not dead, > 0.2%" } } }
me too, think you very much
So I am not alone. This issue is closed on Parcel without an explanation... Removing the engines.node
key or keeping it while adding browsers
definitely work. For whatever it means. This looks like misuses of keys.
remove "engines" config in package.json fixed my issue
What happened?
This prompts when pnpm build, but there is no problem when pnpm dev.
Version
Latest
What OS are you seeing the problem on?
MacOSX
What browsers are you seeing the problem on?
Chrome
Relevant log output
(OPTIONAL) Contribution
Code of Conduct