aurelia / bundler

A library for bundling JavaScript, HTML and CSS for use with SystemJS.
MIT License
37 stars 25 forks source link

Error when loading relative import #106

Closed Scapal closed 8 years ago

Scapal commented 8 years ago

Using ES6 JSPM, while the bundling seems to work and the application runs as expected, there are errors in the browser console with system.js trying to load components already included in the bundle.

For example if I use the skeleton-es2016 and add a test.js:

export class Test {
  test = "hello world";
}

and modify the welcome.js as follow:

import {inject, computedFrom} from 'aurelia-framework';
import {Test} from './test';

@inject(Test)
export class Welcome {
  heading = 'Welcome to the Aurelia Navigation App!';
  firstName = 'John';
  lastName = 'Doe';
  previousValue = this.fullName;

  constructor(test) {
    this.test = test;
  }
...

When bundled, even as the app is running perfectly and accessing the bundled test.js, I will get: system.src.js:4597 GET http://localhost/~pascalfautre/Muungo/skeleton-es2016/test.js 404 (Not Found)

If I do import {Test} from 'test'; then I don't have any error.

ahmedshuhel commented 8 years ago

@Scapal Could you tell us what version of SystemJS and JSPM are you using?

Scapal commented 8 years ago

JSPM 0.16.15 jspm_packages/system.js: v0.19.6

ahmedshuhel commented 8 years ago

I found the problem too. Looking at it now. I will keep you updated.

ahmedshuhel commented 8 years ago

@Scapal can set depCache: false in the bundle config and see if the problem goes away. I think depCache is causing a conflict here.

Scapal commented 8 years ago

@ahmedshuhel it does indeed solve the problem

ahmedshuhel commented 8 years ago

I am closing it here. It's a SystemJS bug/constraint. It seems like bundle and depCache cannot be used in parallel.