Reputation: 593
I try to import and reuse a CSS file to be injected in a shadow-root in Typescript but I cannot get it working with the webpack config. Indeed, I tried adding the following code to Webpack:
{
test: /\.css$/i,
use: [
{
loader: 'css-loader',
options:{
url: false
}
}]
}
But when I try to build, I get the following error:
ERROR Failed to compile with 1 error 10:49:02 AM
error in ./node_modules/tippy.js/dist/tippy.css
Syntax Error: SyntaxError
(1:1) Unknown word
> 1 | // Imports
| ^
2 | var ___CSS_LOADER_API_IMPORT___ = require("../../css-loader/dist/runtime/api.js");
3 | exports = ___CSS_LOADER_API_IMPORT___(false);
@ ./node_modules/tippy.js/dist/tippy.css 4:14-207
@ ./src/extension/content.ts
@ multi ./src/extension/content.ts
I really don't understand what is wrong.
In addition, if I try to import my css file without any loader, doing:
const s = require('tippy.js/dist/tippy.css');
Then s
is an empty object.
Does anyone have any idea what could happen here?
Upvotes: 1
Views: 537