Webpack throws an error
GET http://localhost:8080/sass/main.scss net::ERR_ABORTED 404 (Not Found)
but at start server it loaded page with css. scss imported to js with
import '../sass/main.scss';
webpack config:
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/js/controller.js',
plugins: [
new HtmlWebpackPlugin({
template: './index.html',
}),
],
module: {
rules: [
{
test: /\.html$/i,
use: ['html-loader'],
},
{
test: /\.s[ac]ss$/i,
use: ['style-loader', 'css-loader', 'sass-loader'],
},
],
},
}
Head part of index.html template: link to css here doesn't influence at all, only import inside js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-
scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link
href="https://fonts.googleapis.com/css?
family=Nunito Sans:400,600,700"
rel="stylesheet"
/>
<link rel="shortcut icon" href="/src/img/favicon.png"
type="image/x-icon" />
<link rel="stylesheet" href="/src/saas/main.css" />
<title></title>
<script type="module" src="/src/js/controller.js"></script>
</head>
What could be going wrong?
CodePudding user response:
Resolved. I removed link to script inside index.html
<script type="module" src="src/js/controller.js"></script>
and error is gone. (entry point and html template are already specified in config)