Webpack-encore: Stimulus Controller Lazy Load - Scheme/Path Error - Windows

Created on 6 Feb 2021  路  5Comments  路  Source: symfony/webpack-encore

Hi guys,

I just updated Webpack Encore to 1.0 and Stimulus Bridge to 2.0, and I have an error when I try to add the lazy comment to my controller.
The comment :

/* stimulusFetch: 'lazy' */
export default class extends Controller {
...

The error :

 ERROR  Failed to compile with 1 errors                                                                                                                                                                                                                                                                         14:13:39

 error  in E:Projectmyproject_websiteassetscmscontrollerscollection_controller.js

Syntax Error: Reading from "E:Projectmyproject_websiteassetscmscontrollerscollection_controller.js" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "e:" URIs.

As you can see, the path folder separator is missing in the error log... This might be a windows specific error...

Any help would be appreciated !

Cheerz

bug

All 5 comments

Hey @adrienlamotte!

Hmm, indeed - I bet there are some "wires crossed" somewhere with Windows paths. Question: if you install a ux package (e.g. composer require symfony/ux-chartjs then yarn install --force) and then change the fetch in controllers.json to lazy, do you get the same error? Or does it work there? That might help me figure out exactly where the problem is.

Cheers!

@weaverryan I have @symfony/ux-swup installed, I just tried with fetch: lazy and it does work - no error in that case.

Thanks :)

Thanks for that fast reply!

I think I found the fix, but I don't have a Windows machine handy. Could you possibly replace your node_modules/@symfony/stimulus-bridge/dist/webpack/generate-lazy-controller.js file with this one - https://gist.github.com/weaverryan/2753fdcb81441d3c759680ace6dc07d0 and let me know if it works?

I think we just need to escape \ in the string, which (even though it's impossible to read) is what that files does :)

Thanks!

@weaverryan it works! Thank you ;)

The fix is now up on @symfony/stimulus-bridge 2.0.1 :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iammichiel picture iammichiel  路  3Comments

weaverryan picture weaverryan  路  4Comments

o-alquimista picture o-alquimista  路  3Comments

rebangm picture rebangm  路  4Comments

JohnnyEvo picture JohnnyEvo  路  3Comments