babichjacob / sapper-typescript-graphql-template Goto Github PK
View Code? Open in Web Editor NEWA template that includes Sapper for Svelte, TypeScript preprocessing, and a GraphQL server through TypeGraphQL
License: MIT License
A template that includes Sapper for Svelte, TypeScript preprocessing, and a GraphQL server through TypeGraphQL
License: MIT License
hello. thanks for building this template. I'm currently seeing an issue like in ExampleComponent.svelte
where any sort of type annotations issues an error Type annotations can only be used in TypeScript files
. I was wondering how I might be able to resolve this. thanks!
Hi, If I clone this repository I get typehint errors on all svelte files that read:
Unrecognized option 'defaults'
This photo shows how the "error" appears to occur at the top of every file.
Curiously, this only appears to be an issue with VS Code typescript extension. No issues/errors are reported when running npm run validate
or npm run dev
.
git clone https://github.com/babichjacob/sapper-typescript-graphql-template
cd sapper-typescript-graphql-template
npm i
code .
lang="ts"
does nothing<script>
tag per se. Just the first character in each file.sveltePreprocess
does nothing.See sveltejs/sapper#1375 and sveltejs/template#161 for more details. I think it'd be worth switching to rollup-plugin-typescript2
, which works much better in my limited experience
Now that Svelte TypeScript support is official, people are looking for the same for Sapper.
It would go a long way to show how to remove the GraphQL server some people don't want to demonstrate the right way:tm: to have TypeScript for Sapper.
Trying to use context in the preload function. And I'm getting this error:
I've read a few things describing what's happening, but I'm really not sure how to fix this. Any help would be great!
Git cloned latest master (22a2cce)
Ran npm i
followed by npm run dev
Received error: "Could not resolve entry module (undefined\server.ts)."
For reference:
$ npm -v
6.14.7
$ node -v
v14.8.0
Log:
$ npm run dev
[email protected] dev C:\dev\sapper-typescript-graphql-template
run-p validate:dev sapper:dev
[email protected] validate:dev C:\dev\sapper-typescript-graphql-template
svelte-check --ignore src/node_modules/@sapper --watch
[email protected] sapper:dev C:\dev\sapper-typescript-graphql-template
sapper dev
====================================
svelte-check found no errors and no warnings
✗ client
Could not resolve entry module (undefined\client.ts).
(node:19904) UnhandledPromiseRejectionWarning: Error: Could not find chunk that owns index.svelte
at C:\dev\sapper\dist\create_manifest_data.js:319:19
at Array.forEach ()
at extract_css (C:\dev\sapper\dist\create_manifest_data.js:314:16)
at RollupResult.to_json (C:\dev\sapper\dist\create_manifest_data.js:458:18)
at handle_result (C:\dev\sapper\dist\dev.js:272:55)
at C:\dev\sapper\dist\dev.js:356:17
at WatchEmitter. (C:\dev\sapper\dist\create_manifest_data.js:590:37)
at WatchEmitter.emit (events.js:314:20)
at Watcher.emit (C:\dev\sapper-typescript-graphql-template\node_modules\rollup\dist\shared\watch.js:611:22)
at Watcher.run (C:\dev\sapper-typescript-graphql-template\node_modules\rollup\dist\shared\watch.js:649:18)
(Use node --trace-warnings ...
to show where the warning was created)
(node:19904) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:19904) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
✗ server
Could not resolve entry module (undefined\server.ts).
Hi! Variables with interface throw error "Unexpected token eslint(ParseError)".
This is in the latest clone of the template. "version": "2020.09.10",
npm run eslint:fix
/.../sapper-typescript-graphql-template/src/routes/_layout.svelte
11:20 error Unexpected token ParseError
Eslint highlight show error as well.
export let segment: string = ""; >>> Unexpected token eslint(ParseError)
I faced this problem too in my project. And still can't solve it.
Just wanted to give you a heads up that 0.28.1 is out now, which includes the types. Thanks for all your help in providing this template and testing out TypeScript support!
From Carlo$#3952
on Discord
My issue is this:
//client.ts
import * as sapper from "@sapper/app";
import { setup } from "fileInSRCNodeModules";
(async () => {
await setup();
await sapper.start({
target: document.querySelector("#sapper")
});
)();
When I run
npm run dev
I get:
Could not load C:/example/src/node_modules/fileInSRCNodeModules.ts (imported by C:\example\src\client.ts): Debug Failure. False expression: Expected fileName
to be present in command line
Edit 1:
Creating the file in "/src/someFile.ts"
or even "/src/folder/someFile.ts"
And then calling it from "client.ts"
as -
import { setup } from "./someFile.ts"
works
am I accidently not allowing "node_modules"
access? But "@sapper/app"
works
For now you'd have to use a forked version of Sapper to make it work, so not sure if you'd want to do it yet or wait until the PRs in the main repo get merged. Could at least start testing it out in a branch though maybe
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.