Closed ewilliam closed 4 months ago
While a fix for this problem is investigated, be aware that ink is known to work with Vite, see : https://github.com/floriancargoet/vite-plugin-ink
thanks - i ended up forking the project and specifying type: module
for now https://github.com/ewilliam/inkjs
doubt this works for all cases though
changing es6 output file to .mjs and importing from inkjs/dist/ink-es6.mjs works too
just to add context - looks like vite-plugin-ink doesnt work as is for similar reasons
error when starting dev server:
file:///Users/ewilliam/Projects/inkling/node_modules/.pnpm/vite-plugin-ink@0.1.2_inkjs@https+++codeload.github.com+ewilliam+inkjs+tar.gz+f82e13848368065184de7e230e92d38851c49606/node_modules/vite-plugin-ink/dist/index.js:4
import inkjs from "inkjs";
^^^^^
SyntaxError: The requested module 'inkjs' does not provide an export named 'default'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
at async loadConfigFromBundledFile (file:///Users/ewilliam/Projects/inkling/node_modules/.pnpm/vite@5.2.11_@types+node@20.12.12/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:68705:21)
at async loadConfigFromFile (file:///Users/ewilliam/Projects/inkling/node_modules/.pnpm/vite@5.2.11_@types+node@20.12.12/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:68558:28)
at async resolveConfig (file:///Users/ewilliam/Projects/inkling/node_modules/.pnpm/vite@5.2.11_@types+node@20.12.12/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:68161:28)
at async _createServer (file:///Users/ewilliam/Projects/inkling/node_modules/.pnpm/vite@5.2.11_@types+node@20.12.12/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:64686:20)
at async CAC.<anonymous> (file:///Users/ewilliam/Projects/inkling/node_modules/.pnpm/vite@5.2.11_@types+node@20.12.12/node_modules/vite/dist/node/cli.js:762:24)
ELIFECYCLE Command failed with exit code 1.```
Latest version (2.2.4) should solve all your problems ! Let me know.
yes it does!! thanks so much
I'm having issues importing Story in next.js I got it to work in 2.2.3 by doing this:
//@ts-ignore import { Story } from 'inkjs/dist/ink-full';
I also cannot seem to import Choice anymore like I used to: import Choice from 'inkjs/ink/engine/Choice';
(This works in 2.2.3)
Thoughts?
In 2.2.4, you should be able to do
import {Choice} from "inkjs"
and if you need the Compiler
import {Compiler} from "inkjs/full"
There are no improvement between 2.2.3 and 2.2.4 except this change of packaging so if 2.2.3 works,you're better off not changing version
Hmm, neither of those work for me in 2.2.4
{
"compilerOptions": {
"target": "es2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./app/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
I can freeze my version for now, but I'm expecting we'll need to update at some point here
As of now, there are no scheduled updates of the ink runtime or the inkjs library.
Describe the bug
CommonJS issue with recent SvelteKit versions (2.0+ and vite 4.0+)
recommended default export doesn't work neither
To Reproduce
import { Story } from 'inkjs'
this is all it takes to trigger an error in SvelteKit (presumably any vite app?)
Expected behavior
access to Story export without errors
Ink files
N/A
Environment
Additional Comments
might be helpful/relevant:
https://kit.svelte.dev/docs/faq#how-do-i-fix-the-error-i-m-getting-trying-to-include-a-package
https://publint.dev/inkjs@2.2.2