Webpack Error: The end loader did not return a buffer or string

When I make a build with systemjs successful, but when I do with webpack, I get this error. Error: final loader did not return buffer or string

+4
source share
3 answers

Below are my results after a very long investigation, and many of them are probably

First thing to check

If you use ts-loader , you can get

"No metadata available for NgModule"

If its awesome-typescript -loader , you will get the target error result, for example

  • "The end loader did not return a buffer or string."

, , , awesome- typescript -loader

..

  • import
  • ;
  • ; , .
  • , ,

    css-loader node -sass resolve-url-loader sass-loader \  style-loader url-loader

4.import

ex:

import * from '';

5. , , .

+6

ts-loader, .

  module: {
    loaders: [
      {test: /\.ts$/, loader: 'ts' },
      {test: /\.css$/, loader: 'style!css'},
      {test: /\.html/, loader: 'html'},
      {test: /\.tsx?$/, loader: 'ts-loader'},
      // {test: /\.tsx?$/, loader: 'awesome-typescript-loader'},
      //{test: /\.(ico|png|jpg|gif|svg|eot|ttf|woff|woff2)(\?.+)?$/, loader: 'url?limit=50000'}
    ],
    preLoaders: [
      // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
      { test: /\.js$/, loader: 'source-map-loader' }
    ]
  },
0

, . , , , .

.

class MyClass {
    constructor(){

    };
}

new MyClass();

I removed the semicolon and everything works fine.

 class MyClass {
    constructor(){

    }
}

new MyClass();
0
source

Source: https://habr.com/ru/post/1662816/


All Articles