spencermountain / unrequired

find unused javascript files in your project
108 stars 8 forks source link

JSON support #5

Closed eladbenami closed 5 years ago

eladbenami commented 5 years ago

im getting the following error: $ unrequired ./server/server.js

Compiling the javascript..

npx: installed 4 in 1.501s [!] Error: Unexpected token (Note that you need rollup-plugin-json to import JSON files) node_modules\mongoose\package.json (2:9) 1: { 2: "_from": "mongoose@5.4.11", ^ 3: "_id": "mongoose@5.4.11", 4: "_inBundle": false, Error: Unexpected token (Note that you need rollup-plugin-json to import JSON files) at error (C:\Users\EladBA\AppData\Roaming\npm-cache_npx\2480\node_modules\rollup\dist\rollup.js:9236:30) at Module.error (C:\Users\EladBA\AppData\Roaming\npm-cache_npx\2480\node_modules\rollup\dist\rollup.js:12909:9) at tryParse (C:\Users\EladBA\AppData\Roaming\npm-cache_npx\2480\node_modules\rollup\dist\rollup.js:12825:16) at Module.setSource (C:\Users\EladBA\AppData\Roaming\npm-cache_npx\2480\node_modules\rollup\dist\rollup.js:13102:33) at Promise.resolve.catch.then.then.then (C:\Users\EladBA\AppData\Roaming\npm-cache_npx\2480\node_modules\rollup\dist\rollup.js:15925:20) at

fs.js:646 return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); ^

Error: ENOENT: no such file or directory, open 'C:\Users\EladBA\AppData\Roaming\npm\node_modules\unrequired_tmp-build.js.map' at Object.fs.openSync (fs.js:646:18) at Object.fs.readFileSync (fs.js:551:33) at getUsed (C:\Users\EladBA\AppData\Roaming\npm\node_modules\unrequired\src\get-used.js:12:29) at unrequired (C:\Users\EladBA\AppData\Roaming\npm\node_modules\unrequired\src\index.js:8:14) at Object. (C:\Users\EladBA\AppData\Roaming\npm\node_modules\unrequired\src\bin.js:20:14) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3)

gi-joe-moto commented 5 years ago

I'm running into the same problem. I tried to do sudo npm install -g rollup-plugin-json but it didn't change anything.

spencermountain commented 5 years ago

thanks, i'll take a look this week. it might be an easy fix.

spencermountain commented 5 years ago

hey, i've added that plugin in 0.2.0. For some reason json files don't end-up in the .map file, so i've ignored them from the missing results.

um, so unrequired json files will not be part of the results. i guess that's fine, for now!

lemme know if you have any other problems.