Webpack 4 made its own loaders work weird

Do you want to request a feature or report a bug?
Bug.

What is the current behavior?
See below.

If the current behavior is a bug, please provide the steps to reproduce.
See below.

What is the expected behavior?
See below.

If this is a feature request, what is motivation or use case for changing the behavior?
No.

Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.
Win 10, Node: v8.9.4, npm: 5.6.0, Webpack: 4.1.1

Issue Description:

After I updated from webpack 3.8.1 to version 4.1.1 my raw-loader started to return an object instead of a string.
Before the update in my AngularJS application I could simply do this:

...
template: require('./my-template')
...

and everything worked fine. But now I forced to do like this:

...
template: require('./my-template').default
...

because otherwise variable template will be equal an object:

{
  default: '<tempate data>'
}

instead of a string:

'<tempate data>'

So what is this cr*p and how to return everything at how it was in webpack 3?

Author: Fantashit

1 thought on “Webpack 4 made its own loaders work weird

Comments are closed.