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

File ".js" extension is not being resolved #161

Closed
alexgrozav opened this issue Dec 30, 2021 · 4 comments
Closed

File ".js" extension is not being resolved #161

alexgrozav opened this issue Dec 30, 2021 · 4 comments

Comments

@alexgrozav
Copy link

alexgrozav commented Dec 30, 2021

The issue

Code works during dev, but fails during SSG build. The culprit is the missing file extension when importing.

Stacktrace

[vite-ssg] An internal error occurred.
[vite-ssg] Please report an issue, if none already exists: https://github.com/antfu/vite-ssg/issues
(node:54643) UnhandledPromiseRejectionWarning: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/alexgrozav/Workspace/inkline.io/node_modules/@inkline/inkline/components/IAlert/manifest' imported from /Users/alexgrozav/Workspace/inkline.io/.vite-ssg-temp/main.mjs
Did you mean to import @inkline/inkline/components/IAlert/manifest.js?
    at new NodeError (internal/errors.js:322:7)
    at finalizeResolution (internal/modules/esm/resolve.js:308:11)
    at moduleResolve (internal/modules/esm/resolve.js:731:10)
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:842:11)
    at Loader.resolve (internal/modules/esm/loader.js:89:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:242:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:76:40)
    at link (internal/modules/esm/module_job.js:75:36)

This didn't happen in 0.16.2.

@userquin
Copy link
Member

userquin commented Dec 30, 2021

@alexgrozav the new version 0.17.2 by default is esm (also supports cjs) while 0.16.2 is only cjs, so you should add the extension. You can also try changing the format to cjs on ssgOptions but there is a problem with the binary vite-ssg and maybe build will not work, I have fixed it on #160 (and a few other things):

imagen

@userquin
Copy link
Member

@alexgrozav try with cjs format with the latest version released

@alexgrozav
Copy link
Author

Thank you for the heads up! I'm updating the package to use esm properly.

@xibian1120
Copy link

xibian1120 commented Jul 22, 2022

how to solve it : Unknown file extension ".vue",Which section should I update?

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