CSS @import
causes Rollup error: "you need plugins to import files that are not JavaScript"
#997
Unanswered
acmobileguy
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Looks like you may need to add //tsdx.config.js
const postcss = require('rollup-plugin-postcss');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
module.exports = {
rollup(config, options) {
config.plugins.push(
postcss({
plugins: [
autoprefixer(),
cssnano({
preset: 'default',
}),
],
// only write out CSS for the first bundle (avoids redundant extra files)
extract: !!options.writeMeta,
inject: false,
})
);
return config;
},
}; |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
Hello. i am new to TSDX and typescript in general. I came across TSDX while learning building React components in typescript. My issue is that I am getting and error in my css file where I am importing a google font.
CSS File:
@import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap');
When I build, I get the following:
Error: Unexpected character '@' (Note that you need plugins to import files that are not JavaScript)
Any help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions