Перепробывал кучу вариантов. Помогите исправить ошибку при выполнении команды npm run build.
В папку dist ничего не ложит, css файлы создаёт внутри папки с sass файлом только при запуске run dev.
[0] ./src/index.js 26 bytes {0} [built]
[1] ./src/sass/main.sass 185 bytes {0} [built] [failed] [1 error]
ERROR in ./src/sass/main.sass 2:13
Module parse failed: Unexpected token (2:13)
You may need an appropriate loader to handle this file type.
| h1
> font-size: 12px
|
webpack.config.js
let path = require('path');
let ExtractTextPlugin = require('extract-text-webpack-plugin');
module.export = {
entry: ['webpack/hot/dev-server' , './src/main.js'],
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: __dirname + '/dist',
filename: 'main.js'
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: '/node_modules/'
},
{
test: /\.sass|.scss$/,
// exclude: /node_modules/,
// include: path.join('/dist'),
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
sourceMap: true
}
},
{
loader: 'sass-loader',
options: {
sourceMap: true
}
}
]
})
}
]
},
plugins: [
new ExtractTextPlugin({
filename:'style.css',
disable: false,
allChunks: true
}),
],
devServer: {
overlay: true
},
};
package.json
{
"name": "illusix",
"version": "1.0.0",
"description": "",
"main": "main.js",
"dependencies": {
"jquery": "^3.4.1"
},
"devDependencies": {
"autoprefixer": "^9.5.1",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-3": "^6.24.1",
"css-loader": "^2.1.1",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"mini-css-extract-plugin": "^0.6.0",
"node-sass": "^4.12.0",
"postcss-loader": "^3.0.0",
"sass": "^1.20.1",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"webpack": "^4.32.2",
"webpack-cli": "^3.3.2",
"webpack-dev-server": "^3.4.1",
"webpack-livereload-plugin": "^2.2.0"
},
"scripts": {
"build": "webpack --mode production",
"dev": "webpack-dev-server --mode development --open --watch"
},
"author": "",
"license": "ISC"
}