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

Add support for assets on both dev + default servers #1785

Closed
mike-sheppard opened this issue Oct 18, 2022 · 4 comments
Closed

Add support for assets on both dev + default servers #1785

mike-sheppard opened this issue Oct 18, 2022 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@mike-sheppard
Copy link

Hey folks 👋 this is a follow-up on the discord chat + discourse forum thread to track progress in one place. Appears this will take some time to resolve as it depends on Acorn v3+ release as potentially includes breaking changes.

Issue: when running the dev server, local assets (specifically dynamic imports) on the host domain do not load + errors are logged to the console

Uncaught SyntaxError: expected expression, got '<'

Running yarn dev

  • localhost:3000 ✅ assets load perfectly
  • example.test ❌ assets fail to load (ideally would like this to still serve assets even if they're not 'live reloaded')

Running yarn build

  • example.test ✅ assets load perfectly
@mike-sheppard mike-sheppard changed the title Add support for assets on both webpack & default webserver Add support for assets on both dev + default servers Oct 18, 2022
@kellymears kellymears added the enhancement New feature or request label Oct 22, 2022
@kellymears
Copy link
Member

With acorn v3, as of right now:

export default async bud => {
  bud
    .extensions.remove(`@roots/sage/acorn`)
    .setPublicPath(`/app/themes/roots/public/`)
    // ....
})

preliminary testing indicates that this works for build and dev.

@kellymears
Copy link
Member

This should be fixed in v6.6.0. There is no good way for bud.js to be sniff out the acorn version in use so you will need to opt-in:

bud.sage.setAcornVersion('v3')

@kellymears
Copy link
Member

OK, as of 6.6.8 you no longer need to call bud.sage.setAcornVersion and development builds work in both the context of the dev server and the proxy server (publicPath is the same in both environments).

@kellymears kellymears unpinned this issue Feb 6, 2023
@mike-sheppard
Copy link
Author

Started on a new site today and this is all working perfectly! 🎉 just wanted to say thanks

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

No branches or pull requests

2 participants