vite-plugin-iso-import
Advanced tools
Comparing version 0.0.2 to 0.1.0
{ | ||
"name": "vite-plugin-iso-import", | ||
"description": "Import modules isomorphically", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"author": "Bjorn Lu", | ||
"license": "MIT", | ||
"type": "module", | ||
"types": "./index.d.ts", | ||
"main": "./index.cjs", | ||
"module": "./index.js", | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
"exports": { | ||
"import": "./index.js", | ||
"require": "./index.cjs" | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"index.cjs", | ||
"dist/index.js", | ||
"dist/index.mjs", | ||
"index.d.ts" | ||
@@ -35,3 +34,3 @@ ], | ||
"scripts": { | ||
"build": "rollup index.js -f cjs -o index.cjs -e magic-string,es-module-lexer", | ||
"build": "rollup -c", | ||
"test-dev": "vite --debug", | ||
@@ -41,2 +40,3 @@ "test-build": "pnpm test-build:client && pnpm test-build:server", | ||
"test-build:server": "vite build --debug --outDir test-dist/server --ssr test/main.js", | ||
"why-ts-plugin": "node scripts/createFacadeTsPlugin.js", | ||
"prepublishOnly": "pnpm build" | ||
@@ -51,4 +51,5 @@ }, | ||
"rollup": "^2.53.1", | ||
"typescript": "^4.3.5", | ||
"vite": "^2.4.1" | ||
} | ||
} |
@@ -40,8 +40,22 @@ # vite-plugin-iso-import | ||
Q: What happens if I use an import value that has been stripped off? | ||
> Q: What happens if I use an import value that has been stripped off? | ||
A: You'll get a usual JS error of the value being unreferenced/undefined. Instead, you should always wrap these environment-specific code with `import.meta.env.SSR`. | ||
> Q: Using `?client` and `?server` loses intellisense. | ||
A: The library exports a custom TypeScript plugin that fixes it. Simply update your `jsconfig.json` or `tsconfig.json` like so: | ||
```json | ||
{ | ||
"compilerOptions": { | ||
"plugins": [{ "name": "vite-plugin-iso-import" }] | ||
} | ||
} | ||
``` | ||
And update VSCode's `settings.json` with `"typescript.tsserver.pluginPaths": ["."]`. (Optional if using workspace Typescript version). | ||
## License | ||
MIT |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
9006
155
61
4
1
No