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

Error resolving node_modules dependencies in serve mode #16

Closed
flortsch opened this issue Aug 30, 2022 · 2 comments
Closed

Error resolving node_modules dependencies in serve mode #16

flortsch opened this issue Aug 30, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@flortsch
Copy link

I am currently trying out this plugin and hope I can use it as future replacement of my current setup with Parcel.

Building my project with eleventy-plugin-vite works fine - all scripts, styles and other assets are bundled correctly.
But when running in dev / serve mode, I get an error in the browser stating that it can't resolve node_modules dependencies.

E.g., I import Alpine.js in my main script with:

import Alpine from "alpinejs";

In my base layout, I include my main script like this:

<script type="module" src="/js/index.js"></script>

In my Eleventy config, I do a passthrough-copy of the script:

...
eleventyConfig.addPassthroughCopy("src/www/js");
...

return {
  dir: {
    input: "src/www",
    output: "_site",
  },
};

And I get this error:

Error resolving module specifier “alpinejs”. Relative module specifiers must start with “./”, “../” or “/”.

Any hints / suggestions? Do you face similar issues?

Cheers, Florian

@KiwiKilian
Copy link
Contributor

Experiencing the same with @11ty/[email protected] and @11ty/[email protected]. Might be connected with #9. Reverting to the old behavior as documented fixes it for now:

eleventyConfig.setServerPassthroughCopyBehavior("copy");

@zachleat zachleat added the bug Something isn't working label Jan 27, 2023
@zachleat zachleat added this to the Eleventy Vite Plugin v2.0.0 milestone Jan 27, 2023
@zachleat
Copy link
Member

The fix here shipped with 2.0.0-canary.3 and will ship with 2.0.0 stable shortly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants