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 load package metadata of ... #930

Closed
fragsalat opened this issue Oct 10, 2018 · 7 comments · Fixed by #931
Closed

Unable to load package metadata of ... #930

fragsalat opened this issue Oct 10, 2018 · 7 comments · Fixed by #931

Comments

@fragsalat
Copy link
Contributor

I'm submitting a bug report

  • Library Version:
    1.0.0-beta.1

Please tell us about your environment:

  • Operating System:
    Ubuntu 18.10

  • Node Version:
    10.7.0

  • NPM Version:
    6.1.0
  • Browser:
    all

  • Language:
    ESNext

  • Loader/bundler:
    RequireJS

Current behavior:
When importing a yaml file as text like this: import 'app/feature/i18n/locale/de.yaml'; and you're using the new bundler, an error is thrown. In this case app is the source root for the application and the folder structure looks like this:

root/
  aurelia_project/
  src/
    app/
      feature/
      model/
      view/
      ...
    styles/
    tests/

The actual error is the following:

INFO [Bundler] Tracing files ...
ERROR [PackageAnalyzer] Unable to load package metadata (package.json) of app:
INFO [PackageAnalyzer] Error: cannot resolve npm package folder for "app"
ERROR [Bundler] Unable to analyze app
  • What is the expected behavior?
    By configuring the loader plugin to allow the .yaml extension and adding the yaml extension to the app-bundle source expression it should be possible to import a .yaml file as text into the application.

  • What is the motivation / use case for changing the behavior?
    To include the translation files used for i18n they must be required by the code (at least that worked previously)

@fragsalat
Copy link
Contributor Author

fragsalat commented Oct 10, 2018

I also tested to include the yaml files via the bundle config and got an empty bundle as result

{
  "name": "some2-bundle.js",
  "source": [
    "text!**/*.yaml",
    "**/*.yaml"
  ]
}

As mentioned above I configured the loader as well

"loader": {
  "type": "require",
  "configTarget": "vendor-bundle.js",
  "includeBundleMetadataInConfig": "auto",
  "plugins": [
    {
      "name": "text",
      "extensions": [
        ".html",
        ".css",
        ".yaml"
      ],
      "stub": true
    }
  ]
}

@3cp
Copy link
Member

3cp commented Oct 10, 2018

I will get this sorted.

Meantime, temporary fix:
if your aurelia_project/tasks/process-markup.js didn't use htmlmin, update your aurelia.json, that's all you need.

"markupProcessor": {
  // ...
  "source": "src/**/*.{html,yaml}"
},

If you did use htmlmin, make another task aurelia_project/tasks/process-yaml.js, you need to adjust the content if using TypeScript.

import gulp from 'gulp';
import changedInPlace from 'gulp-changed-in-place';
import project from '../aurelia.json';
import {build} from 'aurelia-cli';

export default function processMarkup() {
  return gulp.src('src/**/*.yaml')
    .pipe(changedInPlace({firstPass: true}))
    .pipe(build.bundle());
}

Update aurelia_project/tasks/build.js to take the new task.

import processYaml from './process-yaml';

let build = gulp.series(
  readProjectConfiguration,
  gulp.parallel(
    transpile,
    processMarkup,
    processYaml,
    processCSS,
    copyFiles
  ),
  writeBundles
);

@fragsalat
Copy link
Contributor Author

i'll try this tomorrow thank you! :)

@3cp
Copy link
Member

3cp commented Oct 10, 2018

You can try the cli branch "aurelia-cli": "huochunpeng/cli#missing-yaml",

@fragsalat
Copy link
Contributor Author

fragsalat commented Oct 11, 2018

Your branch seem to work for me 👍
Thanks for the fast help :)

When is the next release day?

@3cp
Copy link
Member

3cp commented Oct 11, 2018

It should be soon.

@fragsalat
Copy link
Contributor Author

I've another bug for you^^
It's about revisions are not inserted into index.html for other bundles as vendor-bundle.
I'll create a new issue for it, just a second :)

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

Successfully merging a pull request may close this issue.

2 participants