Arif Khan
Arif Khan

Reputation: 246

Angular 14 Unexpected token / in JSON at position 0 at makeWebpackError

Angular 14 development build not working when enabling sourceMap true

[error] HookWebpackError: Unexpected token / in JSON at position 0
    at makeWebpackError (C:\Users\AK\Desktop\app\cc\node_modules\webpack\lib\HookWebpackError.js:48:9)
    at C:\Users\AK\Desktop\app\cc\node_modules\webpack\lib\Compilation.js:3060:12
    at eval (eval at create (C:\Users\AK\Desktop\app\cc\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:44:1)
    at fn (C:\Users\AK\Desktop\app\cc\node_modules\webpack\lib\Compilation.js:480:17)
    at _next2 (eval at create (C:\Users\AK\Desktop\app\cc\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:41:1)
    at eval (eval at create (C:\Users\AK\Desktop\app\cc\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:60:1)
-- inner error --

SyntaxError: Unexpected token / in JSON at position 0
    at JSON.parse (<anonymous>)
    at C:\Users\AK\Desktop\app\cc\node_modules\@angular-devkit\build-angular\src\webpack\plugins\devtools-ignore-plugin.js:42:38
    at fn (C:\Users\AK\Desktop\app\cc\node_modules\webpack\lib\Compilation.js:478:10)
    at _next2 (eval at create (C:\Users\AK\Desktop\app\cc\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:41:1)
    at eval (eval at create (C:\Users\AK\Desktop\app\cc\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:60:1)

Upvotes: 1

Views: 2344

Answers (3)

below43
below43

Reputation: 547

For me this issue was caused by an unnecessary include in my assets folder (it only occurred when sourceMap: true was set in angular.json). I added --watch to the serve command and it gave a good hint which file it was.

Upvotes: 1

Arif Khan
Arif Khan

Reputation: 246

I had an empty bootstrap.min.css.map file in the assets folder that caused this issue.

Upvotes: 0

Nikolay Stoyanov
Nikolay Stoyanov

Reputation: 13

I have a commom issue because I have copied all the static files from an ASP.NET Core MVC web app including the "lib" folder. When I deleted it, everything is working fine now, so take a look on your static files. Hope it would help you!

Upvotes: 1

Related Questions