aurelia / bundler

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

Failed to bundle skeleton-typescript #119

Closed seesharper closed 8 years ago

seesharper commented 8 years ago

Hi! Bundling started to fail at our build servers last night for some reason. Up until last night our builds has been running flawlessly for months.

It is pretty easy to reproduce though.

Get the latest skeleton-typescript from the skeleton repo

npm install
jspm install
gulp bundle

Error message:

[20:26:05] Error on fetch for app.js at file:///C:/Github/skeleton-typescript/dist/app.js
        Error: ENOENT: no such file or directory, open 'C:\Github\skeleton-typescript\dist\app.js.map'
    at Error (native)

I also have a folder locally on my machine where everything works as expected. Its been weeks since I did npm/jspm install in this folder. I suspect that either npm install or jspm install pulls down something that has changed somewhere, but it is like finding a needle in a haystack to say the least :)

Environment: Windows 10 Node v4.4.0

Update: Just tried node 4.4.4 (LTS), but the issue remains.

This is a pretty critical issue. Anybody else run into this. Maybe @EisenbergEffect could give us a hint :)

njappboy commented 8 years ago

I'm seeing the same issue and same error. Source maps are created inline, I see app.js.map in dist/app.js

If I comment out these 2 lines the process works as expected (minus sourcemaps of course): https://github.com/aurelia/skeleton-navigation/blob/master/skeleton-typescript/build/tasks/build.js#L22 https://github.com/aurelia/skeleton-navigation/blob/master/skeleton-typescript/build/tasks/build.js#L24

njappboy commented 8 years ago

I changed package.json to use an earlier version "aurelia-bundler": "0.3.0" but the same issue still persists.

njappboy commented 8 years ago

@seesharper did you have any luck resolving this issue?

seesharper commented 8 years ago

Well, if I comment out those two lines in the build taks, the bundle task succeeds. The strange thing is that the build task alone also completes without errors. I can get by without the source maps in production, but they are sure nice to have when debugging. So maybe a custom build task used only when bundling. But still I think it is important that the skeleton apps works as expected out of the box.

dilvish4ever commented 8 years ago

Same issue on fresh install. I have two locations with same source files - old works fine, new - this error.

EisenbergEffect commented 8 years ago

@ahmedshuhel Please take a look.

krostkowski commented 8 years ago

It's for sure some node module. After I made npm install 15 minutes ago 'gulp bundle' stopped working. I'm looking which module could do it.

krostkowski commented 8 years ago

@dilvish4ever Can you check differences in node modules versions? I do not have a working copy now.

dilvish4ever commented 8 years ago

module -> working -> not working

systemjs-builder -> 0.15.16 -> 0.15.17 babel-core (inside system-builder) -> 6.8.0 -> 6.9.0

krostkowski commented 8 years ago

Thank you, there is some issue with systemjs-builder 0.15.17. With 0.15.16 it's working.

seesharper commented 8 years ago

For a NPM novice, how do I fix this? Is it possible to lock to version 0.15.16 somehow?

On Mon, May 23, 2016 at 9:13 AM, Kamil Rostkowski notifications@github.com wrote:

Thank you, there is some issue with systemjs-builder 0.15.17. With 0.15.16 it's working.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/aurelia/bundler/issues/119#issuecomment-220903582

krostkowski commented 8 years ago

In your package.json: "systemjs-builder": "0.15.16" (without ^)

KernowCode commented 8 years ago

Where precisely in the package.json do we put "systemjs-builder": "0.15.16" (without ^) ?

KernowCode commented 8 years ago

Confirmed workaround for me was to rename "aurelia-bundler": "^0.3.0" to "aurelia-bundler": "0.3.0" in package.json

njappboy commented 8 years ago

Failing back to 0.3.0 did not work for me when I tried it.

krostkowski commented 8 years ago

@njappboy for me it didn't work either

seesharper commented 8 years ago

Remember to delete node_modules and jspm_packages and do a clean restore

On Monday, 23 May 2016, Kamil Rostkowski notifications@github.com wrote:

@njappboy https://github.com/njappboy for me it didn't work either

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/aurelia/bundler/issues/119#issuecomment-220988190

ahmedshuhel commented 8 years ago

@EisenbergEffect I believe the problem started after this PR got merged. This is a great feature if it works specially in the cases like skeleton-typescript where we are providing a transpiled version of the code to the bundler and keeping or using the original source map makes a lot sense here instead of bundler generating source map of the transpiled code. The build task generating files like this:

define(["require", "exports"], function (require, exports) {
    "use strict";
    var App = (function () {
        function App() {
        }
        App.prototype.configureRouter = function (config, router) {
            config.title = 'Aurelia';
            config.map([
                { route: ['', 'welcome'], name: 'welcome', moduleId: 'welcome', nav: true, title: 'Welcome' },
                { route: 'users', name: 'users', moduleId: 'users', nav: true, title: 'Github Users' },
                { route: 'child-router', name: 'child-router', moduleId: 'child-router', nav: true, title: 'Child Router' }
            ]);
            this.router = router;
        };
        return App;
    }());
    exports.App = App;
});
//# sourceMappingURL=app.js.map
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwLmpzIiwic291cmNlUm9vdCI6Ii9zcmMiLCJzb3VyY2VzIjpbImFwcC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztJQUVBO1FBQ

Please notice the //#sourceMappingURL=app.js.map here. The build task do not generate a file like app.js.map in the dist folder and bundler/systemjs-builder is trying to load this file from there.

Is our build task correctly configured to generate source maps?

There is a discussion going on here https://github.com/systemjs/builder/issues/297

EisenbergEffect commented 8 years ago

@ahmedshuhel My guess is that the build task would need to change in order to account for that.

ahmedshuhel commented 8 years ago

I am taking a look at how gulp source map works that we used in our build task. I will let everyone know if I find something. Basically, without //#sourceMappingURL=app.js.map bundler works fine.

ahmedshuhel commented 8 years ago

@EisenbergEffect I have submitted a PR for skeleton-navigation to to address this issue.

ahmedshuhel commented 8 years ago

@all Please try changing .pipe(sourcemaps.write({includeContent: false, sourceRoot: '/src'})) to .pipe(sourcemaps.write('.', {includeContent: false, sourceRoot: '/src'})) in the build.js file and let us know.

ahmedshuhel commented 8 years ago

Where would the PR go? Github is acting wired today with me! Strange.

ahmedshuhel commented 8 years ago

@all please try changing .pipe(sourcemaps.write({includeContent: false, sourceRoot: '/src'})) to .pipe(sourcemaps.write('.', {includeContent: false, sourceRoot: '/src'})) in build/tasks/build.js and let us know.

EisenbergEffect commented 8 years ago

Is this an issue across multiple skeletons? If so, we need to update it everywhere...

ahmedshuhel commented 8 years ago

Yes, I will send the PR again if needed once Github gets settled. It's not showing me my comments or PR that I made already.

njappboy commented 8 years ago

@seesharper of course I delete the /node_modules folder. (not a newbie)

@ahmedshuhel See weird issues with github today as well. I don't like seeing the Rainbow unicorn.

dilvish4ever commented 8 years ago

@ahmedshuhel new error:

[10:25:09] 'bundle' errored after 35 s
[10:25:09] Error on fetch for github:components/jqueryui@1.11.4/themes/base/core.css!github:systemjs/plugin-css@0.1.21.js at file:///c:/project/jspm_packages/github/components/jqueryui@1.11.4/themes/base/core.css!file:///c:/project/jspm_packages/github/systemjs/plugin-css@0.1.21.js
        TypeError: loaderFetch.call(...).then is not a function
    at c:\project\node_modules\aurelia-bundler\node_modules\systemjs-builder\lib\builder.js:180:8
    at SystemJSNodeLoader.<anonymous> (c:\project\node_modules\aurelia-bundler\dist\bundler.js:75:14)
    at SystemJSNodeLoader.loader.fetch (c:\project\node_modules\aurelia-bundler\node_modules\systemjs-builder\lib\builder.js:178:59)
    at c:\project\node_modules\aurelia-bundler\node_modules\systemjs-builder\lib\trace.js:425:23
    at tryCatcher (c:\project\node_modules\aurelia-bundler\node_modules\systemjs-builder\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (c:\project\node_modules\aurelia-bundler\node_modules\systemjs-builder\node_modules\bluebird\js\release\promise.js:502:31)
    at Promise._settlePromise (c:\project\node_modules\aurelia-bundler\node_modules\systemjs-builder\node_modules\bluebird\js\release\promise.js:559:18)
    at Promise._settlePromise0 (c:\project\node_modules\aurelia-bundler\node_modules\systemjs-builder\node_modules\bluebird\js\release\promise.js:604:10)
    at Promise._settlePromises (c:\project\node_modules\aurelia-bundler\node_modules\systemjs-builder\node_modules\bluebird\js\release\promise.js:683:18)
    at Async._drainQueue (c:\project\node_modules\aurelia-bundler\node_modules\systemjs-builder\node_modules\bluebird\js\release\async.js:138:16)
    at Async._drainQueues (c:\project\node_modules\aurelia-bundler\node_modules\systemjs-builder\node_modules\bluebird\js\release\async.js:148:10)
    at Immediate.Async.drainQueues [as _onImmediate] (c:\project\node_modules\aurelia-bundler\node_modules\systemjs-builder\node_modules\bluebird\js\releaseasync.js:17:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)
[10:25:09] Finished 'export' after 48 s
Souldrinker commented 8 years ago

I just ran into this issue too in my real app (not built on skeleton) where I use VS2015 to transpile my typescript and then the babel-runtime to transpile it in the browser.

In my case however it initially complained about the last line in my jspm installed package github:nolimits4web/Swiper@^3.3.1/dist/js/swiper.js: //# sourceMappingURL=maps/swiper.js.map. When I removed that I got an error similar too @dilvish4ever, that is loaderFetch.call(...).then is not a function from plugin-css@0.1.21 with some mentions of font-awesome and bluebird in the call stack.

...so at that time I gave up and found this issue. After adding "systemjs-builder": "0.15.16", to the npm devDependencies in my package.json it started working again, so I'm good for now.

But I'm wondering what the real fix here will be (since I probably don't want to be stuck at an outdated version of systemjs-builder). Is this due to a bug in systemjs builder 0.15.17 (that will be fixed in .18) or is this intentional and will be fixed in a future version of the aurelia-builder, because if I understood the earlier discussions in this thread the fix was going to be in the way the skeleton builds the sourcemaps and not in the bundler which I'm not sure will help me?

ahmedshuhel commented 8 years ago

@Souldrinker It's a twofold problem or bug. One was in our skeleton. The skeletons were not configured to generate the sourcemaps correctly. That we solved. But you and @dilvish4ever is experiencing the other problem introduced in systemjs-builder's latest version. I believe a discussion is going on here about this problem systemjs/builder#297

Before that gets resolved I assume it's better to stay with systemjs-builder v0.15.6 as you have done.

EisenbergEffect commented 8 years ago

Closing since the issue was fixed via a merge.