You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 472385e
Browse filesBrowse the repository at this point in the historyBrowse files
"(!) Your Vite config uses features that are unsupported by \`configLoader: 'native'\`, which is planned to become the default in a future major version of Vite:
1736
+
- named import from JSON module "./data.json" (vite.config.js:1:10). JSON modules only provide a default export per spec. Use the default import and access the property
1737
+
Set \`VITE_CONFIG_NATIVE_IGNORE_WARNING=true\` to suppress this warning.",
1738
+
]
1739
+
`)
1740
+
})
1741
+
1742
+
test('warns on named import from a bare JSON specifier',async()=>{
"(!) Your Vite config uses features that are unsupported by \`configLoader: 'native'\`, which is planned to become the default in a future major version of Vite:
1747
+
- named import from JSON module "some-pkg/package.json" (vite.config.js:1:10). JSON modules only provide a default export per spec. Use the default import and access the property
1748
+
Set \`VITE_CONFIG_NATIVE_IGNORE_WARNING=true\` to suppress this warning.",
1749
+
]
1750
+
`)
1751
+
})
1752
+
1753
+
test('does not warn on JSON default imports (`default as` included)',async()=>{
Copy file name to clipboardExpand all lines: packages/vite/src/node/__tests__/fixtures/config/native-compat/json-named-import-bare/node_modules/some-pkg/package.json
Copy file name to clipboardExpand all lines: packages/vite/src/node/__tests__/fixtures/config/native-compat/json-named-import-ok/node_modules/some-pkg/package.json
: `import "${item.specifier}" resolves to a JSON file (${loc}). Import it with a \`.json\` extension and \`with { type: 'json' }\``
259
+
case'json-named-import':
260
+
return`named import from JSON module "${item.specifier}" (${loc}). JSON modules only provide a default export per spec. Use the default import and access the property`
197
261
case'esm-syntax-in-cjs':
198
262
return`ESM syntax in a file loaded as CommonJS (${loc}). Use a \`.mjs\` extension or set \`"type": "module"\` in the closest package.json`
0 commit comments