windicss / windicss-analysis

🔍 A visual analyzer for Windi CSS
https://analysis-demo.windicss.org
MIT License
129 stars 7 forks source link

[BUG] Bundle of this package fails due to JSON #5

Closed alexanderniebuhr closed 3 years ago

alexanderniebuhr commented 3 years ago

I need to bundle this extension (more runAnalysis function), so it works outside of DEBUG for VS Code Extension

import { runAnalysis } from "windicss-analysis";
[!] Error: Unexpected token (Note that you need @rollup/plugin-json to import JSON files)
node_modules\statuses\codes.json (2:7)
1: {
2:   "100": "Continue",
          ^
3:   "101": "Switching Protocols",
4:   "102": "Processing",
Error: Unexpected token (Note that you need @rollup/plugin-json to import JSON files)
    at error (C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense\node_modules\rollup\dist\shared\rollup.js:5305:30)
    at Module.error (C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense\node_modules\rollup\dist\shared\rollup.js:9750:16)
    at Module.tryParse (C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense\node_modules\rollup\dist\shared\rollup.js:10156:25)
    at Module.setSource (C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense\node_modules\rollup\dist\shared\rollup.js:10057:24)
    at ModuleLoader.addModuleSource (C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense\node_modules\rollup\dist\shared\rollup.js:18396:20)
    at async ModuleLoader.fetchModule (C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense\node_modules\rollup\dist\shared\rollup.js:18452:9)
    at async Promise.all (index 0)
    at async ModuleLoader.fetchStaticDependencies (C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense\node_modules\rollup\dist\shared\rollup.js:18478:34)        
    at async Promise.all (index 0)
    at async ModuleLoader.fetchModule (C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense\node_modules\rollup\dist\shared\rollup.js:18454:9)

npm ERR! code 1
npm ERR! path C:\Users\Alexander\Documents\projects\windicss\windicss-intellisense
npm ERR! command failed
npm ERR! command C:\Program Files\PowerShell\7-preview\pwsh.exe -c cross-env NODE_ENV=production rollup -c

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Alexander\AppData\Local\npm-cache\_logs\2021-03-30T10_55_00_244Z-debug.log
 ERROR  npm failed with exit code 1
antfu commented 3 years ago

Then try install @rollup/plugin-json?

alexanderniebuhr commented 3 years ago

builds now, but on running I still get :/

🐛 ERROR: Error: Cannot find module 'windicss-analysis'
Require stack:
- c:\Users\Alexander\.vscode\extensions\voorjaar.windicss-intellisense-0.7.1\out\extension.js
- c:\Program Files\Microsoft VS Code\resources\app\out\vs\loader.js
- c:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-amd.js
- c:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-fork.js
Error: Cannot find module 'windicss-analysis'
Require stack:
....
alexanderniebuhr commented 3 years ago

nervermind.. found the typo