milesj / packemon

📦 Build and prepare packages for npm distribution using standardized configurations and practices. Gotta pack 'em all!
https://packemon.dev
MIT License
203 stars 3 forks source link

Is it possible to disable asset imports? #229

Closed SlexAxton closed 5 months ago

SlexAxton commented 5 months ago

I am using vanilla extract, which imports .ts files called foo.css.ts

So in application code, it ends up looking like an asset import and triggers that pipeline.

import {vanillaExtractClass} from './file.css';

Then if I run packemon against a library that uses this:

ENOENT: no such file or directory, copyfile
 '/Users/alex/project/packages/@project/ui/src/Badge.css' ->
 '/Users/alex/project/packages/@project/ui/assets/Badge-70d967
 b6.css'

Presumably because there is no .css file. It's referring to a .css.ts file and the normal import behavior is what i'm after.

I don't actually need this feature, so it'd be fine if I could somehow disable it, or minimally disable it for .css files. My guess is there's some way to inject a rollup config override, but I haven't found the exact right magic.

milesj commented 5 months ago

There's no way to disable it, but we can patch it to check if the file actually exists.

milesj commented 5 months ago

@SlexAxton Can you try 3.3.0?

SlexAxton commented 5 months ago

Hey, sorry for the delay, don't get to work on this one every day, but this worked great. You're a hero. :pray: