guybedford / chomp

'JS Make' - parallel task runner for the frontend ecosystem with a JS extension system.
https://chompbuild.com
Apache License 2.0
138 stars 7 forks source link

Conflict in target extension causes dependency fighting #91

Closed canadaduane closed 2 years ago

canadaduane commented 2 years ago

I have two problems:

  1. I've forgotten how to tell chomp how to compile both svelte (.svelte) and typescript (.ts) to javascript (.js)
  2. When I naively ran chomp build using the below chompfile, chomp tried installing swc multiple times
version = 0.1
extensions = ['chomp@0.1:swc', 'chomp@0.1:svelte']

[env]
PACKAGE_MANAGER = "pnpm"

[template-options.npm]
auto-install = true

[[task]]
name = 'build'
deps = ['build:typescript', 'build:svelte']

[[task]]
name = 'build:typescript'
template = 'swc'
target = 'lib/#.js'
deps = ['src/#.ts']

[[task]]
name = 'build:svelte'
template = 'svelte'
target = 'lib/#.js'
deps = ['src/#.svelte']

Here is the output:

devDependencies:
+ @swc/cli 0.1.55
+ @swc/core 1.2.155
+ mkdirp 1.0.4
Downloading registry.npmjs.org/@swc/core-linux-x64-musl/1.2.155: 21.9 MB/21.9 MB, done
Downloading registry.npmjs.org/@swc/core-linux-x64-gnu/1.2.155: 20.7 MB/20.7 MB, done
Downloading registry.npmjs.org/@swc/core-linux-x64-gnu/1.2.155: 19.2 MB/20.7 MB
  lib/main.js invalidated by node_modules/@swc/core
Downloading registry.npmjs.org/@swc/core-linux-x64-gnu/1.2.155: 20.1 MB/20.7 MB
Downloading registry.npmjs.org/@swc/core-linux-x64-gnu/1.2.155: 20.7 MB/20.7 MB, done
Progress: resolved 38, reused 24, downloaded 3, added 3, done
  lib/App.js invalidated by node_modules/svelte
🞂 lib/App.js
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received null
    at writeFile (node:internal/fs/promises:760:5)
    at file:///home/duane/Relm/art-studio/[cm]:21:9 {
  code: 'ERR_INVALID_ARG_TYPE'
}
x lib/App.js [90.167254ms]
x :build:svelte
x :build
Unable to complete all tasks.

I think this is similar to #33

$ chomp --version
Chomp 0.1.12
guybedford commented 2 years ago

Thanks for posting, fixed in https://github.com/guybedford/chomp-extensions/commit/7ab888bea622fd2be9845c8e05ba6ad8de62ee29.