-
Notifications
You must be signed in to change notification settings - Fork 150
Can't resolve typescript class #138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
{
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.5",
"@rollup/plugin-commonjs": "11.0.2",
"@rollup/plugin-node-resolve": "^7.0.0",
"dart-sass": "^1.25.0",
"pug": "^2.0.4",
"rollup": "^1.20.0",
"rollup-plugin-livereload": "^1.0.0",
"rollup-plugin-svelte": "^5.0.3",
"rollup-plugin-terser": "^5.1.2",
"sass": "^1.26.5",
"svelte": "^3.0.0",
"svelte-preprocess": "^3.7.4",
"typescript": "^3.8.3"
},
"dependencies": {
"bootstrap": "^4.4.1",
"sirv-cli": "^0.4.4"
}
} |
If i use js class like this: export class Pet {
constructor(height = 2) {
this.height = height;
}
} it's working but typescript classes can't be imported |
I had the same problem. I could solve this by using a typescript loader in the project. I tried both Rollup and Webpack, and I had a better experience with ts-loader in Webpack. I have a template example here: https://github.com/fhassis/web-typescript/tree/svelte-typescript , in the branch "svelte-typescript". |
If you want to |
This looks like it might be a duplicate of #159. I wonder if you add a |
Fixed in |
// src/App.svelte
// src/models/Pet.ts
Logs
bundles src/main.js → public/build/bundle.js...
[!] Error: Could not resolve './models/Pet' from src/App.svelte
Error: Could not resolve './models/Pet' from src/App.svelte
at error (/home/ilya/WebstormProjects/room-scheme/node_modules/rollup/dist/shared/node-entry.js:5400:30)
at ModuleLoader.handleResolveId (/home/ilya/WebstormProjects/room-scheme/node_modules/rollup/dist/shared/node-entry.js:12410:24)
at ModuleLoader. (/home/ilya/WebstormProjects/room-scheme/node_modules/rollup/dist/shared/node-entry.js:12298:30)
at Generator.next ()
at fulfilled (/home/ilya/WebstormProjects/room-scheme/node_modules/rollup/dist/shared/node-entry.js:38:28)
// tsconfig.json
// rollup.config.js
The text was updated successfully, but these errors were encountered: