sapper-typescript-graphql-template icon indicating copy to clipboard operation
sapper-typescript-graphql-template copied to clipboard

Hot reloading (automatic refreshing) from TypeScript files

Open babichjacob opened this issue 5 years ago • 2 comments

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

babichjacob avatar Jul 10 '20 02:07 babichjacob

~~Live reload possibly not working~~ Probably an upstream problem

babichjacob avatar Jul 11 '20 20:07 babichjacob

I manually added livereload: import livereload from "rollup-plugin-livereload"; to rollup.config and set it the config to dev && livereload("sapper/dev"), This allows the hot reload off of any rebuilds - however - since sapper already rebuilds by default on all changes but .ts files - this causes the reload to happen twice on files except .ts So - Iooked through the sapper cli and you can set the reload to false I modified the npm run dev to be: "dev": "cross-env ROLLUP_WATCH=true sapper dev --live false", Now, it rebuilds accordingly

image

babichjacob avatar Jul 11 '20 22:07 babichjacob