aurelia / cli

The Aurelia 1 command line tool. Use the CLI to create projects, scaffold components, and bundle your app for release.
MIT License
407 stars 134 forks source link

Error when using material-design-iconic-font with new CLI/require #934

Closed cluka closed 6 years ago

cluka commented 6 years ago

I'm submitting a bug report

Please tell us about your environment:

Current behavior: au start displays an error when it tries to bundle material-design-iconic-font

Error is in the image cli-error

zewa666 commented 6 years ago

@huochunpeng the main of the package is an array. Never seen that

cluka commented 6 years ago

Ok. So it's all ok with my registration of the font in Aurelia bundler? And this font does work without problem in Aurelia webpack

zewa666 commented 6 years ago

@cluka actually no idea, but thats what I'd guess. Just mentioned that I wasn't aware you could use an array for main, so perhaps this is causing the new aurelia auto-tracer to choke

cluka commented 6 years ago

Maybe, I see that there are multiple pull request on it's github that fixes the main that should be string and to move the array to files.

3cp commented 6 years ago

There are two issues here.

  1. strange main. They definitely didn't follow spec https://docs.npmjs.com/files/package.json#main This is not a bug for us to fix, it's one for them.

This issue can be fixed with an explicit config

"dependencies": [
  //...
  {
    "name": "material-design-iconic-font",
    "path": "../node_modules/material-design-iconic-font",
    "main": "dist/css/material-design-iconic-font.min.css"
  }
]

For that reason, this issue can be closed.

  1. I saw you updated your post to use <require from="some.css"></require>. cli+requirejs has never supported import "some.css" in js file, our cli+webpack supports it with style-loader plugin.

I think it could be a good improvement to cli+requirejs to support import "some.css", so people can easily migrate their code from webpack app to requirejs app. I will keep it on my todo list.

3cp commented 6 years ago

I will make cli more resilient in this situation, instead of panic, I can ignore the malformed main. You will see a missing main warning, but css import will still work.

3cp commented 6 years ago

The fix means you don't need explicit config in aurelia.json.

cluka commented 6 years ago

@huochunpeng Damn you're fast :-). Thanks man. About the import edit, yes i did replace it with require, as it was like you thought, I moved from webpack.

I think it could be a good improvement to cli+requirejs to support import "some.css", so people can easily migrate their code from webpack app to requirejs app.

It's fine for me, now that i know how to import them.

3cp commented 6 years ago

Congratulations for migrating from webpack to cli bundler!

It will take some time to heal your trauma, you might still wake up in nightmare in next few weeks. Deep breathe, brother, Deep breathe... it was all over now. 🤣

cluka commented 6 years ago

Lol

On Fri, Oct 12, 2018, 09:51 huochunpeng notifications@github.com wrote:

Congratulations for migrating from webpack to cli bundler!

It will take some time to heal your trauma, you might still wake up in nightmare in next few weeks. Deep breathe, brother, Deep breathe... it was all over now. 🤣

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aurelia/cli/issues/934#issuecomment-429237494, or mute the thread https://github.com/notifications/unsubscribe-auth/ABvhiP4j4evuOt9qYv8cYdTfir0UOcbWks5ukEnrgaJpZM4XXdUb .