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

Unable to import node module with ".js" in name #349

Closed
powerbuoy opened this issue Oct 2, 2016 · 6 comments
Closed

Unable to import node module with ".js" in name #349

powerbuoy opened this issue Oct 2, 2016 · 6 comments
Labels

Comments

@powerbuoy
Copy link

I'm submitting a bug report

  • Library Version:
    0.18.0

Please tell us about your environment:

  • Operating System:
    OSX 10.x|Linux (distro)|Windows [7|8|8.1|10]

  • Node Version:
    6.7.0

  • NPM Version:
    3.10.3

  • Browser:
    all

  • Language:
    ESNext

Current behavior:
When I npm install --save-dev jump.js and later add it ("jump.js" literaly - its main property points to its only JS file) to aurelia.json build.bundles[].dependencies I get Error: ENOENT: no such file or directory, open '/home/powerbuoy/.../src/main/resources/static/jump.js'

If I do the same with say "moment" everything works fine.

Expected/desired behavior:

That I don't get an error.

@EisenbergEffect
Copy link
Contributor

Try using a different name in your js and in the aurelia.json mapping. Here's an example for chart.js which has a similar problem:

         {
            "name": "chartjs",
            "path": "../node_modules/chart.js/Chart.min",
            "exports": "Chart"
          }

@powerbuoy
Copy link
Author

powerbuoy commented Apr 24, 2017

@EisenbergEffect Is this a limitation in Aurelia CLI or should one avoid naming packages with a "." regardless?

If it's an issue with Aurelia CLI only, is there any plan to fix it?

The reason I'm asking is I'm now unable to import a ChartJS plugin because it looks for a package named "chart.js" - not "chartjs" and I can't reasonably ask them to change their name unless this isn't an Aurelia issue.

@JeroenVinke
Copy link
Collaborator

@powerbuoy could you provide more info so I can reproduce the issue with the chartjs plugin?

@powerbuoy
Copy link
Author

@JeroenVinke All I did was create a new Aurelia CLI project, npm install chart.js then add chart.js to my dependencies in aurelia_project/aurelia.json. The project won't build because the name contains a period.

Thanks to chartjs/chartjs-plugin-deferred#2 I did notice though that as long as I supply a path I can still name the package with a period which makes it all work.

Would still be nice if we didn't have to supply the path manually.

@zewa666
Copy link
Member

zewa666 commented Apr 27, 2017

@powerbuoy I dont really think that is feasible as the path is made exactly for this kind of scenarios. @JeroenVinke we could though try to through a better error message, so the users get better instructions how to switch to using the path property.

@powerbuoy
Copy link
Author

Ok I see, well as long as I can keep the period in the name everything works at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants