Module build failed: Error: Final loader didn't return a Buffer or String


#1

Hi, I sporadically get this error when I make a change in and the project is rebuilt and live reloaded. It’s strange because all I do to fix the error is re-save the page in question without making any changes (which hadn’t even been modified). It seems to happen randomly once every 20 or so live-reloads.

Uncaught Error: Module build failed: Error: Final loader didn't return a Buffer or String
    at /Users/greg/ionicproject/node_modules/webpack/lib/NormalModule.js:151:64
    at /Users/greg/ionicproject/node_modules/loader-runner/lib/LoaderRunner.js:365:3
    at iterateNormalLoaders (/Users/greg/ionicproject/node_modules/loader-runner/lib/LoaderRunner.js:206:10)
    at iterateNormalLoaders (/Users/greg/ionicproject/node_modules/loader-runner/lib/LoaderRunner.js:213:10)
    at /Users/greg/ionicproject/node_modules/loader-runner/lib/LoaderRunner.js:228:3
    at context.callback (/Users/greg/ionicproject/node_modules/loader-runner/lib/LoaderRunner.js:106:13)
    at Object.typescriptSourcemapLoaderMemory (/Users/greg/ionicproject/node_modules/@ionic/app-scripts/dist/webpack/typescript-sourcemap-loader-memory.js:21:5)
    at /Users/greg/ionicproject/node_modules/webpack/lib/NormalModule.js:151:64
    at /Users/greg/ionicproject/node_modules/loader-runner/lib/LoaderRunner.js:365:3
    at iterateNormalLoaders (/Users/greg/ionicproject/node_modules/loader-runner/lib/LoaderRunner.js:206:10)
    at iterateNormalLoaders (/Users/greg/ionicproject/node_modules/loader-runner/lib/LoaderRunner.js:213:10)
    at /Users/greg/ionicproject/node_modules/loader-runner/lib/LoaderRunner.js:228:3
    at context.callback (/Users/greg/ionicproject/node_modules/loader-runner/lib/LoaderRunner.js:106:13)
    at Object.typescriptSourcemapLoaderMemory (/Users/greg/ionicproject/node_modules/@ionic/app-scripts/dist/webpack/typescript-sourcemap-loader-memory.js:21:5)
    at eval (/Users/greg/ionicproject/src/pages/feature/page-walkthrough.ts:1:7)
    at Object.<anonymous> (http://localhost:8100/build/main.js:3256:1)
    at __webpack_require__ (http://localhost:8100/build/main.js:20:30)
    at eval (/Users/greg/ionicproject/src/pages/feature/page.ts:4:91)
    at Object.<anonymous> (http://localhost:8100/build/main.js:3263:1)
    at __webpack_require__ (http://localhost:8100/build/main.js:20:30)
    at eval (/Users/greg/ionicproject/src/pages/tabs/tabs.ts:4:79)
    at Object.<anonymous> (http://localhost:8100/build/main.js:3250:1)
    at __webpack_require__ (http://localhost:8100/build/main.js:20:30)
    at eval (/Users/greg/ionicproject/src/app/app.component.ts:4:75)
    at Object.<anonymous> (http://localhost:8100/build/main.js:5759:1)
    at __webpack_require__ (http://localhost:8100/build/main.js:20:30)
    at eval (/Users/greg/ionicproject/src/app/app.module.ts:4:73)
    at Object.<anonymous> (http://localhost:8100/build/main.js:5094:1)
    at __webpack_require__ (http://localhost:8100/build/main.js:20:30)
    at eval (/Users/greg/ionicproject/src/app/main.dev.ts:2:70)

This what the file in question likes like when it fails to build:

throw new Error("Module build failed: Error: Final loader didn't return a Buffer or String\n    at /Users/john/web/curiconi2/node_modules/webpack/lib/NormalModule.js:151:64\n    at /Users/john/web/curiconi2/node_modules/loader-runner/lib/LoaderRunner.js:365:3\n    at iterateNormalLoaders (/Users/john/web/curiconi2/node_modules/loader-runner/lib/LoaderRunner.js:206:10)\n    at iterateNormalLoaders (/Users/john/web/curiconi2/node_modules/loader-runner/lib/LoaderRunner.js:213:10)\n    at /Users/john/web/curiconi2/node_modules/loader-runner/lib/LoaderRunner.js:228:3\n    at context.callback (/Users/john/web/curiconi2/node_modules/loader-runner/lib/LoaderRunner.js:106:13)\n    at Object.typescriptSourcemapLoaderMemory (/Users/greg/ionicproject/node_modules/@ionic/app-scripts/dist/webpack/typescript-sourcemap-loader-memory.js:21:5)");

//////////////////
// WEBPACK FOOTER
// ./src/pages/feature/page-walkthrough.ts
// module id = 475
// module chunks = 0

And the source file in question:
import { Component } from ‘@angular/core’;
import { ViewController } from ‘ionic-angular’;

@Component({
  selector: 'page-wedgetail-walkthrough',
  templateUrl: 'wedgetail-walkthrough.html'
})
export class WedgetailWalkthroughPage {

    constructor(public viewCtrl: ViewController) {}    

    dismiss() {
     //let data = { 'foo': 'bar' };
     this.viewCtrl.dismiss();
   }
}

Any ideas?

Ionic version: 2.1.18


#2

Having the same problem. Very annoying.

Ionic Framework: 2.0.0-rc.4
Ionic Native: 2.2.11
Ionic App Scripts: 0.0.47
Angular Core: 2.2.1
Angular Compiler CLI: 2.2.1
Node: 6.8.1
OS Platform: Windows 10
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36