Comments (3)
Hey, just ran into this issue myself, it seems like in bundle there are both .js and .cjs files from this package. It can be a problem because of webpack / babel configuration, that forces to use commonjs instead of es6 modules.
I added "sideEffects": false to my package.json and it worked
But sideEffects can be tricky
By default Typescript uses CommonJs module resolution, so you can also set
"module": "ES2020",
"target":"ES2020",
"moduleResolution": "Bundler",
in your tsconfig.ts. It also will force to use only es6 module resolution
Related issue on ts-loader:
TypeStrong/ts-loader#886 (comment)
from webext-bridge.
Thank you for your response, I have been waiting to get some time to learn and play around. Tonight I have spent a few hours playing around with my tsconfig and Vite bundler settings, and nothing has changed unfortunately. I also tested setting "sideEffects":"false"
in my package.json file. I always use "type":"module"
Here are my latest configurations maybe you might have some more insight
{
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
"compilerOptions": {
"target": "es2020",
"useDefineForClassFields": true,
"module": "es2020",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
}
}
And my vite.config.js build settings (I removed the server configs for brevity) I just added the build target value to vite for testing, but did not originally set it.
plugins: [ vue() ],
build: {
cssCodeSplit: true,
rollupOptions: {
plugins: [],
},
target: "es2020",
},
optimizeDeps: {
exclude: ['']
},
css: {
postcss: postcss
},
from webext-bridge.
So I have been messing around a bit more. I downloaded the latest master branch into my local source tree and built it locally.
I was able to do some more tracing.
Only when tracing, I can catch the following exceptions, and see the promise being rejected with the screenshot below. Without the debugger attached, the promises returned from sendMessage()
never actually complete (resolve or reject). This type of JS behavior is new to me. I have to assume this is a bundler or browser related issue. I haven't found a silver bullet bundler/tsconfig setting yet. I removed all intervals/timers that may have been blocking the event loop somehow, no change.
from webext-bridge.
Related Issues (20)
- Sending message from popup to background crashed (Cannot read properties of undefined reading fingerprint) HOT 4
- Window post message within an iframe. use parent.postMessage? HOT 1
- [Bug] `DataTypeKey` not working on `onMessage` and `sendMessage` parameter `messageID` HOT 3
- Pratical exemple how to send message between my js and background-script. HOT 1
- High cpu and ram usage HOT 3
- Messages only received after page refresh HOT 8
- Latest version import failure related HOT 3
- Background stream sendMessage to any tab does not working
- Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist. HOT 3
- This script should only be loaded in a browser extension. HOT 3
- Hard to debug unhandled promise errors HOT 1
- 在 Vite中使用报错 TypeError: Cannot read properties of undefined (reading 'fingerprint') HOT 2
- Project unmaintained - looking for maintainers HOT 8
- [Feature]sidePanel messaging
- Create landing page & docs site HOT 2
- Update README
- Automate website PR deployments & previews
- Create automated NPM release process
- `tabId` is null when `stream.send` from background script
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webext-bridge.