-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overview: Porting preactjs.com to WMR #809
Comments
IIRC, |
I threw together a quick implementation of the (though I think just changing the code is likely the more logical approach) |
Not sure which AST transforms you're running into, but if it's when processing things like |
For the Worker stuff, Comlink feels like it'd be a better option here. Bundling can be done by adding this config: import OMT from '@surma/rollup-plugin-off-main-thread';
export default function({ mode, plugins }) {
if (mode === 'build') {
let omt = OMT({ silenceESMWorkerWarning: true });
omt.outputOptions({ format: 'esm' }); // this plugin method does validation that breaks in Rollup 2+
delete omt.outputOptions; // ... so we spoof it and delete the method (since it was just for validation)
omt.enforce = 'pre';
plugins.push(omt);
}
}; ... the using import { wrap } from 'comlink';
function createWorker() {
let worker = wrap(new Worker(new URL('./worker.js', import.meta.url), { type: 'module' }));
return worker;
}
// ...
let transformed = await worker.process(code); |
It looks like the double transform issue we've been observing for a while. It happens with the markdown parser: function applyEmoji(content) {
// ... snip
if (!pendingEmojiProcessor) {
// BAD replacement
pendingEmojiProcessor = import(
/@alias/~/lib/gh-emoji/index.js'./gh-emoji'
).then(({ replace }) => (processEmojis = replace || String));
}
return pendingEmojiProcessor.then(processEmojis => processEmojis(content));
} |
Turns out the wrong AST was caused by an offset issue in our import specifier logic. See #823 |
With WMR 3.7.0 all those issues are no fixed 🎉 |
Today I've attempted to port https://preactjs.com over from
preact-cli
towmr
. These are the issues I ran into:.less
stylesheets Add support for compiling.less
stylesheets #806.json
files - I think we should just rename the few imports in preact-www Use explicit.json
and.module.less
extension in import specifiers preact-www#791.less
files need to be renamed to.module.less
- We should just rename them in preact-www Use explicit.json
and.module.less
extension in import specifiers preact-www#791~
for aliasing, but WMR expects~/
- Not sure how much work would be needed to support that in WMR, we could just use standard path imports insteadasync!
webpack loaders withpreact-iso
- There is only one place where it's used explicitely, need to add back code-splitting of pages later thoughjson:
prefixes don't work with aliased paths - I'd love to drop the prefixes all together and replace them with?module
Fix unable to load.json
files outside of public directory #810.less
imports during production buildsnpm registry lookup failed for "mixins.less"
Warning: ICSS ("composes:") is only supported in CSS Modules
, otherwise it's a guessing gameworkerize-loader!
webpack loaders with something elsethis.emitFile({ id: "src/foo.js", type: "chunk" })
, required for https://github.com/surma/rollup-plugin-off-main-thread - WMR now has built-in support for web workerspreact-iso
that isn't needed anymoreThe text was updated successfully, but these errors were encountered: