GithubHelp home page GithubHelp logo

svelte-draft-template's People

Contributors

fractalhq avatar mistlog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

fabian-michael

svelte-draft-template's Issues

Race condition between TypeScript and Rollup

Issue

There is a race condition on first run. App.svelte cannot be resolved on first run of the dev script, yet can be resolved on the second run (or upon saving App.tsx). I guess this is because main.js refers to App.Svelte, yet TypeScript hasn't transpiled App.tsx to App.svelte yet.

Installation

git clone https://github.com/mistlog/svelte-draft-template.git
cd svelte-draft-template
npm install

Running the dev script for the first time ❌

npm run dev
> [email protected] dev /Users/jwork/Documents/git/svelte-draft-template
> concurrently "npm run transcribe:watch" "rollup -c -w"

[0] 
[0] > [email protected] transcribe:watch /Users/jwork/Documents/git/svelte-draft-template
[0] > sd ./src -w
[0] 
[1] rollup v1.30.1
[1] bundles src/main.js → public/build/bundle.js...
[1] [!] Error: Could not resolve './App.svelte' from src/main.js
[1] Error: Could not resolve './App.svelte' from src/main.js
[1]     at error (/Users/jwork/Documents/git/svelte-draft-template/node_modules/rollup/dist/shared/node-entry.js:5400:30)
[1]     at ModuleLoader.handleResolveId (/Users/jwork/Documents/git/svelte-draft-template/node_modules/rollup/dist/shared/node-entry.js:12389:24)
[1]     at ModuleLoader.<anonymous> (/Users/jwork/Documents/git/svelte-draft-template/node_modules/rollup/dist/shared/node-entry.js:12277:30)
[1]     at Generator.next (<anonymous>)
[1]     at fulfilled (/Users/jwork/Documents/git/svelte-draft-template/node_modules/rollup/dist/shared/node-entry.js:38:28)
[1] 

Running the transcribe:watch script subsequently ✅

npm run transcribe:watch

> [email protected] transcribe:watch /Users/jwork/Documents/git/svelte-draft-template
> sd ./src -w

Running the rollup -c -w script subsequently ✅

node_modules/.bin/rollup -c -w

  Your application is ready~! 🚀

  - Local:      http://localhost:5000

────────────────── LOGS ──────────────────

  [15:46:23] 200 ─ 4.33ms ─ /
  [15:46:23] 200 ─ 1.63ms ─ /global.css
  [15:46:23] 200 ─ 1.44ms ─ /build/bundle.css
  [15:46:23] 200 ─ 1.78ms ─ /build/bundle.js
  [15:46:23] 200 ─ 14.93ms ─ /favicon.png

Running the dev script subsequently once more ✅

npm run dev

  Your application is ready~! 🚀

  - Local:      http://localhost:5000

────────────────── LOGS ──────────────────

  [15:46:23] 200 ─ 4.33ms ─ /
  [15:46:23] 200 ─ 1.63ms ─ /global.css
  [15:46:23] 200 ─ 1.44ms ─ /build/bundle.css
  [15:46:23] 200 ─ 1.78ms ─ /build/bundle.js
  [15:46:23] 200 ─ 14.93ms ─ /favicon.png

Solution

In Webpack, in each rule, it is possible to provide an array of loaders to define an ordered pipeline by which to process files during the bundling process. It is quite common to process from SCSS -> CSS before bundling, for example. I'm sure Rollup will have an equivalent API allowing the TypeScript Compiler (or Babel) to be used to watch .tsx files and process them to .svelte files (ideally without emitting them to disk) without having to deal with a race condition between rollup and TypeScript. What do you think about this approach?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.