turbo_boost-streams icon indicating copy to clipboard operation
turbo_boost-streams copied to clipboard

Could not resolve "@turbo-boost/streams"

Open scart88 opened this issue 1 year ago • 4 comments

The latest version gives the following error:

06:28:33 js.1     | ✘ [ERROR] Could not resolve "@turbo-boost/streams"
06:28:33 js.1     |
06:28:33 js.1     |     application.js:4:7:
06:28:33 js.1     |       4 │ import '@turbo-boost/streams'
06:28:33 js.1     |         ╵        ~~~~~~~~~~~~~~~~~~~~~~
06:28:33 js.1     |
06:28:33 js.1     |   You can mark the path "@turbo-boost/streams" as external to exclude it from the bundle, which will remove this error.
06:28:33 js.1     |
06:28:33 js.1     | ✘ [ERROR] Could not resolve "@turbo-boost/streams"
06:28:33 js.1     |
06:28:33 js.1     |     dash.js:4:7:
06:28:33 js.1     |       4 │ import '@turbo-boost/streams'
06:28:33 js.1     |         ╵        ~~~~~~~~~~~~~~~~~~~~~~
06:28:33 js.1     |
06:28:33 js.1     |   You can mark the path "@turbo-boost/streams" as external to exclude it from the bundle, which will remove this error.

When adding it as external in the esbuild.config file it works, but then there is a new error in the browser console

external: ['@turbo-boost/streams']

Browser error:

application-c5bd17dfd24a3d59e2010e71cb69e23e4f7cf88ddf71a41142d1cdbbcd4568ac.js:23 Uncaught Error: Dynamic require of "@turbo-boost/streams" is not supported
    at application-c5bd17dfd24a3d59e2010e71cb69e23e4f7cf88ddf71a41142d1cdbbcd4568ac.js:23:11
    at application.js:4:8
    at application.js:185:2
(anonymous) @ application-c5bd17dfd24a3d59e2010e71cb69e23e4f7cf88ddf71a41142d1cdbbcd4568ac.js:23
(anonymous) @ application.js:4
(anonymous) @ application.js:185

Thank you!

scart88 avatar Feb 12 '24 04:02 scart88

Are you still seeing this with v0.1.11+?

hopsoft avatar Mar 01 '24 05:03 hopsoft

Thank you, I will try today and I will close the issue if the error is gone.

scart88 avatar Mar 01 '24 08:03 scart88

Hey @hopsoft

The was was still here. I'm using esbuild to build my assets.

Uncaught Error: Dynamic require of "@turbo-boost/streams" is not supported
    at application-26686a7004df534a1ac8ce2d4a0206737a2caa72ad61f29c6d8682175b4c56e4.js:23:11
    at application.js:6:8
    at application.js:197:2
turbo.es2017-esm.js:3691 Error: <turbo-stream action="invoke" target="DOM">: unknown action
    at StreamElement.raise (turbo.es2017-esm.js:3767:15)
    at get performAction (turbo.es2017-esm.js:3728:18)
    at Object.renderElement [as render] (turbo.es2017-esm.js:3684:26)
    at turbo.es2017-esm.js:3703:36
    at async StreamElement.connectedCallback (turbo.es2017-esm.js:3688:13)

I removed this from the esbuild.config.mjs file and the error is gone.

 external: ['@turbo-boost/streams']

The main problem now is that nothing happens when I click the buttons. I see no request sent in the network tab. https://github.com/hopsoft/turbo_boost-streams/assets/84858745/96b21f0b-d9cc-4bcc-b04a-fe6f19b4e12a

The old turbo-stream scripts (with alpinejs morph) are still working. https://github.com/hopsoft/turbo_boost-streams/assets/84858745/1edaae63-3fed-4fc4-93cc-d9ca8f78baee

Do I have to update turbo-boost/commands as well?

Thank you!

scart88 avatar Mar 04 '24 03:03 scart88

I updated the turbo-boost/commands to the latest version and I think it works; however, the turbo_boost.meta_tag is not available anymore and I'm getting the Token mismatch!

TurboBoost::Commands::InvalidTokenError (Token mismatch! The token: eyJf.........a8c37dee564d` does not match the expected value of
 `znlGbcoEJ7PYc`.):

scart88 avatar Mar 04 '24 04:03 scart88

All these issues are fixed now.

scart88 avatar Jun 20 '24 10:06 scart88