Closed altryne closed 2 years ago
Looks like including the type assertion in the Vite config fixes this.
import { defineConfig } from 'vite'
import { crx } from '@crxjs/vite-plugin'
-import manifest from './manifest.json'
+import manifest from './manifest.json' assert {type: 'json'}
export default defineConfig({
plugins: [crx({ manifest })],
})
It does indeed, that's how I've been working so far, just wanted to highlight as documentation has no record of assertion types
PRs are welcome! Docs are in packages/vite-plugin-docs
and use Docusaurus.
Looks like this was introduced in Node 17, so docs will need to support both since we support Node >=14.
I am facing same issue when updated the playwright version to 1.45. Using the session cookies to get store in state file and then issue is happening for that json file. Does it has anything to do with node.js and Playwright versions compatibility ?
TypeError [ERR_IMPORT_ATTRIBUTE_MISSING]: Module "file:///C:/e2e/helpers/state/user-gda-P1.1720012578177.json" needs an import attribute of "type: json" at validateAttributes (node:internal/modules/esm/assert:88:15) at defaultLoad (node:internal/modules/esm/load:143:3) at async nextLoad (node:internal/modules/esm/hooks:791:22) at async nextLoad (node:internal/modules/esm/hooks:791:22) at async Hooks.load (node:internal/modules/esm/hooks:383:20) at async MessagePort.handleMessage (node:internal/modules/esm/worker:255:18) { code: 'ERR_IMPORT_ATTRIBUTE_MISSING'
Build tool
Vite
Where do you see the problem?
Describe the bug
Following the basic instructions shows an error on importing json.
TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]:... needs an import assertion of type "json"
Reproduction
Follow the CRXJS basic steps with node v18.6.0
Logs
System Info