Replies: 2 comments 4 replies
-
It's not clear what you are expecting to happen, since node cannot execute css files, and |
Beta Was this translation helpful? Give feedback.
4 replies
-
Provided some instructions on how to resolve this and a simple library here: node-css-require. Running the following code before requiring any CSS will prevent the SyntaxError:
This will work in vanilla Node.js, TypeScript and ts-node. Happy to hear of any better approaches or ideas for improvement! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to import a CSS file from a TypeScript source as follows:
My problem is that I receive the following error:
Here a sample GitHub project I put together: https://github.com/mxro/ts-node-files-test
What I have tried:
ts-node
documentation.--files
directive (package.json#L7)typings.d.ts
file that declares adeclare module '*.css';
typings.d.ts
file in the tsconfig"includes"
arrayts-node
loads thetypings.d.ts
file (output.txt#L6)Note that running
tsc
over the same project runs without issue.Beta Was this translation helpful? Give feedback.
All reactions