bensampaio / webpack-globals-loader

MIT License
8 stars 1 forks source link

Module '/var/www/laravel/robo.cash/node_modules/globals/index.js' is not a loader (must have normal or pitch function) #5

Closed dmitryuk closed 7 years ago

dmitryuk commented 7 years ago

Hello, I have received following error then compile webpack Module '/var/www/laravel/robo.cash/node_modules/globals/index.js' is not a loader (must have normal or pitch function)

I trying to use outdated-browser package as globals require("globals!outdated-browser/outdatedbrowser/outdatedbrowser");

bensampaio commented 7 years ago

@xakzona which version of webpack are you using?

ovidiupw commented 7 years ago

Hi, I'm also getting a similar error. Here are my webpack-related dependencies in package.json:

"webpack": "^2.6.1",
"webpack-dev-server": "^2.4.5",
"webpack-merge": "^4.1.0"

The error I get is

node_modules/globals/index.js' is not a loader (must have normal or pitch function)

And what I tried to do was

require('globals!sdks/api-gateway-js-sdk/apiGateway-js-sdk/apigClient.js');
bensampaio commented 7 years ago

The webpack version is the problem. This module is not compatible with webpack 2.

ovidiupw commented 7 years ago

Thanks for the quick response!

I managed to achieve similar working behavior by using, in my package.json

 "script-loader": "^0.7.0"

and requiring scripts like this:

require('!!script-loader!path/to/scripts/relative/to/root_folder/script.js');