Comments (4)
Frankly speaking - have no idea how to conditionally target package for a 'worker'. Probably it will be node
+ browser
+ default
(not node and not browser).
But you know - if something is not clear, and ESM/node exports are 'not clear' - let's not use it. And this is why I am not using them.
You might look into two solutions:
- (isolate, preferred) a separate
named entrypoint
for a worker. Just put a package.json into a named directory. - (hide, popular) remove
import from 'fs'
and doeval("require('fs')")
where needed.
from used-styles.
That is actually a really good solution to unblock yourself as well as being able to verify assumption and provide a way forward for the 'mainstream'
from used-styles.
Hey @theKashey, I have tested this library with Clouldflare worker, and it works great. All we need is to use loadStyleDefinitions
and pass the client assets through Couldfare KV for dev/prod. So I'm trying to split the loadStyleDefinitions
from discoverProjectStyles
(which relies on fs
that doesn't run on worker). And plan to use conditional exports for the worker users. But I'm wondering how to export different build files by lib-builder? Can't find related documents for that
from used-styles.
Hmm... the wired thing is even though we did isolate, once a module containing fs
related things is exported that isn't used in the project, the worker still initializes it and fails to run.
For now, I will fork this library and modify it for running on the worker.
from used-styles.
Related Issues (20)
- Override inline styles HOT 7
- renderToNodeStream example HOT 4
- TypeError: Cannot read property 'isReady' of undefined HOT 1
- Is moving / removing styles mandatory? HOT 5
- media query support HOT 5
- Support publicURL HOT 8
- Inline full files and exclude them from loading twice HOT 1
- Styles priority HOT 1
- Correct rules order HOT 1
- detect when classes from different files are used on single node
- No dist in published package HOT 3
- Below The Fold
- Unlock selectors on discovery HOT 1
- Styles with same selector and content but different media are missing
- Usage example for CRA HOT 2
- `:not()` pseudo selector support HOT 2
- React 17 support HOT 2
- Rule filtering
- React 18 (WebPack 5) doesn't work HOT 1
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 used-styles.