Skip to content
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

Support fastboot #25

Open
mabab opened this issue Feb 16, 2024 · 4 comments
Open

Support fastboot #25

mabab opened this issue Feb 16, 2024 · 4 comments

Comments

@mabab
Copy link

mabab commented Feb 16, 2024

Is there any way to support fastboot?
After install the ember-cli-fastboot package to test-app, I get an error every time I render a page.

Error occurred:

  • While rendering:
    -top-level
    application

There was an error running your app in fastboot. More info about the error:
ReferenceError: Cannot access 'WEBPACK_DEFAULT_EXPORT' before initialization
at Module.default (webpack://test-app/./components/outer.js?:3:42)
at Resolver._extractDefaultExport (webpack://test-app/../rewritten-packages/ember-resolver.7aaf7ce6/node_modules/ember-resolver/resolvers/classic/index.js?:390:25)
at Resolver.resolveOther (webpack://test-app/../rewritten-packages/ember-resolver.7aaf7ce6/node_modules/ember-resolver/resolvers/classic/index.js?:150:32)
at Resolver.resolve (webpack://test-app/../rewritten-packages/ember-resolver.7aaf7ce6/node_modules/ember-resolver/resolvers/classic/index.js?:171:23)
at resolve (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/container/index.js:764:1)
at Registry.resolve (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/container/index.js:522:1)
at Registry.resolve (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/container/index.js:524:1)
at factoryFor (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/container/index.js:237:1)
at Container.factoryFor (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/container/index.js:184:1)
at ApplicationInstance.factoryFor (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/runtime/lib/mixins/container_proxy.js:32:1)
at componentFor (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/glimmer/index.js:4397:1)
at lookupComponentPair (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/glimmer/index.js:4404:1)
at ResolverImpl.lookupComponent (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/glimmer/index.js:4525:1)
at resolveComponent (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/opcode-compiler.js:194:1)
at encodeOp (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/opcode-compiler.js:2126:1)
at pushOp (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/opcode-compiler.js:2067:1)
at /var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/opcode-compiler.js:1715:1
at Compilers.compile (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/opcode-compiler.js:417:1)
at compileStatements (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/opcode-compiler.js:2070:1)
at maybeCompile (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/opcode-compiler.js:2049:1)
at CompilableTemplateImpl.compile (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/opcode-compiler.js:2032:1)
at Object.evaluate (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/runtime.js:2973:1)
at AppendOpcodes.evaluate (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/runtime.js:1052:1)
at LowLevelVM.evaluateSyscall (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/runtime.js:4214:1)
at LowLevelVM.evaluateInner (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/runtime.js:4185:1)
at LowLevelVM.evaluateOuter (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/runtime.js:4178:1)
at VM.next (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/runtime.js:5009:1)
at VM._execute (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/runtime.js:4996:1)
at VM.execute (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/runtime.js:4971:1)
at /var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/runtime.js:5054:1
at runInTrackingTransaction (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/validator.js:138:1)
at TemplateIteratorImpl.sync (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/runtime.js:5054:1)
at /var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/glimmer/index.js:4726:1
at RootState.render (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/glimmer/index.js:4695:1)
at /var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/glimmer/index.js:4988:1
at inTransaction (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@glimmer/runtime.js:4090:1)
at Renderer._renderRoots (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/glimmer/index.js:4970:1)
at Renderer._renderRootsTransaction (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/glimmer/index.js:5014:1)
at Renderer._renderRoot (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/glimmer/index.js:4959:1)
at Renderer._appendDefinition (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/glimmer/index.js:4884:1)
at Renderer.appendOutletView (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/@ember/-internals/glimmer/index.js:4874:1)
at invokeWithOnError (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/backburner.js:292:1)
at Queue.flush (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/backburner.js:197:1)
at DeferredActionQueues.flush (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/backburner.js:360:1)
at Backburner._end (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/backburner.js:801:1)
at Backburner._boundAutorunEnd (/var/folders/gl/c42_2hp924lfn758_fsfbzl80000gn/T/broccoli-329491Acw9O3IGCE1/out-546-packager_runner_embroider_webpack/assets/backburner.js:525:1)
at processTicksAndRejections (node:internal/process/task_queues:95:5)

@backspace
Copy link
Contributor

hmm is test-app part of a V2 addon? We do have Fastboot present in the project where I used this so it seems supported at least in some contexts.

@mabab
Copy link
Author

mabab commented Feb 22, 2024

hmm is test-app part of a V2 addon? We do have Fastboot present in the project where I used this so it seems supported at least in some contexts.

Maybe I didn't explain it correctly. I just intentionally added ember fastboot locally for test-app to emulate the error I get in the project with fastboot. It seemed to me that test-app is the perfect example to pass on to you.

In short, I have a fastboot application that cannot render the page on the server due to an error if I add <style> to the component and I get an empty page without the component, but in the browser the rendering is normal since the initialization on the client is already working.

In cardstack, I found a disabled ember fastboot for the ember serve
https://github.com/cardstack/boxel/blob/main/packages/host/package.json
Is it necessary for work?

reproduce the problem in your own empty project https://github.com/mabab/test-scoped-css-with-fastboot

@backspace
Copy link
Contributor

Thanks for the reproduction repository, when I run it I do see that error as well as this one above it:

There was an error running your app in fastboot. More info about the error:
 ReferenceError: document is not defined
    at insertStyleElement (webpack://test-scoped-css/../../.pnpm/[email protected][email protected]/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js?:93:15)

I’m not sure how to proceed here but I’ll look more into this.

@gossi
Copy link

gossi commented Jul 11, 2024

I see it working for me with ember-cli-fastboot but saw the ReferenceError: document is not defined when using it in combination with prember.

I couldn't find a proper trace, only the stacktrace to prember build call. But yours above reveals style-loader at v2.0.0 which does use document

A pnpm why reveals, that ember-auto-import uses style-loader@v2.

Oh v4.0.0 is the current version of style-loader at the time of writing, they also do use document for their runtime. I think it comes down to that usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants