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

import userInit fails in pages built on Windows #226

Open
evanj2357 opened this issue Sep 3, 2021 · 1 comment
Open

import userInit fails in pages built on Windows #226

evanj2357 opened this issue Sep 3, 2021 · 1 comment

Comments

@evanj2357
Copy link

The Javascript import generated by wrapHtml at elm-pages/generator/src/pre-render-html.js:43 breaks when building on Windows 10 due to platform-dependent behavior in path.join. Specifically, when I run elm-pages dev on Windows 10 and visit the dev server at https://localhost:1234, Chrome reports Uncaught TypeError: Failed to resolve module specifier "index.js". Relative references must start with either "/", "./", or "../". in the console. Firefox reports the same error. The error is due to a backslash in the import path (ex. import userInit from"\index.js";), which occurs because path.join uses backslashes to join paths on Windows.

Replacing path.join with path.posix.join in this instance seems to fix the problem by forcing the use of forward slashes in the generated path.

Software versions:
Node v16.8.0
Elm 0.19.1
elm-pages v2.1.9 (npm)
Chrome 92.0.4515.159
Firefox 91.0.2
Windows 10 version 21H1

@dillonkearns
Copy link
Owner

Thank you for filing the issue @evanj2357. I think we have a fix for this. The next release will go out once #256 is resolved.

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

2 participants