0👍
✅
Turned out I just forgot to define a loader for css files. Even though I’m still wondering why webpack just exits with some error code…
However, here’s a part of my updated webpack.config.js
.
module.exports.module.rules
does now contain this:
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
👤sk22
0👍
The syntax you are using to import css is wrong, it should be like following in your index.html as is given in the documentation:
<link rel="stylesheet"
href="node_modules/material-components-web/dist/material-components-web.css">
But node_modules
will not be accessible as you are using webpack, you can move this file to your static folder and import it like following:
<link rel="stylesheet" href="/static/material-components-web.css" type="text/css">
Following is complete code from documentation:
<!DOCTYPE html>
<html class="mdc-typography">
<head>
<title>Material Components for the web</title>
<link rel="stylesheet" href="/static/material-components-web.css" type="text/css">
</head>
<body>
//HTML where you use material components
<script src="/static/material-components-web.js"></script>
<script>mdc.autoInit()</script>
</body>
</html>
Source:stackexchange.com