Webpack работал, потом из-за небольших перетасовок в папке (часть файлов была взята из старой версии проекта) при попытке выполнить webpack получаю:
ERROR in ./node_modules/css-loader?minimize!./node_modules/sass-loader/lib/loader.js?sourceMap!./sass/style.scss
Module not found: Error: Can't resolve '../images/services/consumer-protection.pnggi' in '/var/www/pravx.loc/wp-content/themes/pravo_promo/sass'
@ ./node_modules/css-loader?minimize!./node_modules/sass-loader/lib/loader.js?sourceMap!./sass/style.scss 6:50142-50197
С отображением деталей ошибок webpack --display-error-details:
ERROR in ./node_modules/css-loader?minimize!./node_modules/sass-loader/lib/loader.js?sourceMap!./sass/style.scss
Module not found: Error: Can't resolve '../images/services/consumer-protection.pnggi' in '/var/www/pravx.loc/wp-content/themes/pravo_promo/sass'
resolve '../images/services/consumer-protection.pnggi' in '/var/www/pravx.loc/wp-content/themes/pravo_promo/sass'
using description file: /var/www/pravx.loc/wp-content/themes/pravo_promo/package.json (relative path: ./sass)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /var/www/pravx.loc/wp-content/themes/pravo_promo/package.json (relative path: ./sass)
using description file: /var/www/pravx.loc/wp-content/themes/pravo_promo/package.json (relative path: ./images/services/consumer-protection.pnggi)
no extension
Field 'browser' doesn't contain a valid alias configuration
/var/www/pravx.loc/wp-content/themes/pravo_promo/images/services/consumer-protection.pnggi doesn't exist
*
Field 'browser' doesn't contain a valid alias configuration
/var/www/pravx.loc/wp-content/themes/pravo_promo/images/services/consumer-protection.pnggi* doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/var/www/pravx.loc/wp-content/themes/pravo_promo/images/services/consumer-protection.pnggi.js doesn't exist
.scss
Field 'browser' doesn't contain a valid alias configuration
/var/www/pravx.loc/wp-content/themes/pravo_promo/images/services/consumer-protection.pnggi.scss doesn't exist
as directory
/var/www/pravx.loc/wp-content/themes/pravo_promo/images/services/consumer-protection.pnggi doesn't exist
[/var/www/pravx.loc/wp-content/themes/pravo_promo/images/services/consumer-protection.pnggi]
[/var/www/pravx.loc/wp-content/themes/pravo_promo/images/services/consumer-protection.pnggi*]
[/var/www/pravx.loc/wp-content/themes/pravo_promo/images/services/consumer-protection.pnggi.js]
[/var/www/pravx.loc/wp-content/themes/pravo_promo/images/services/consumer-protection.pnggi.scss]
[/var/www/pravx.loc/wp-content/themes/pravo_promo/images/services/consumer-protection.pnggi]
@ ./node_modules/css-loader?minimize!./node_modules/sass-loader/lib/loader.js?sourceMap!./sass/style.scss 6:50142-50197
webpack -v 3.5.5
node -v v6.11.1
npm -v 3.10.10
package.json{
"name": "site.ru",
"version": "1.0.0",
"description": "New Design",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Oleg",
"license": "ISC",
"devDependencies": {
"css-loader": "^0.28.4",
"extract-text-webpack-plugin": "^2.1.2",
"file-loader": "^0.11.2",
"hamburgers": "^0.9.1",
"img-loader": "^2.0.0",
"jquery": "^3.2.1",
"node-reset-scss": "^1.0.1",
"node-sass": "^4.5.3",
"optimize-css-assets-webpack-plugin": "^2.0.0",
"postcss-loader": "^2.0.6",
"resolve-url-loader": "^2.0.3",
"sass-loader": "^6.0.6",
"style-loader": "^0.18.2",
"webpack": "^3.4.1"
},
"dependencies": {
"html-loader": "^0.5.1",
"ts-loader": "^2.3.3"
}
}
webpack.config.js
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
require('node-reset-scss');
var config =
{
context: path.resolve(__dirname),
entry:
[
// './js/jquery.js',
// './js/slick.min.js',
// './js/jquery.cookie.js',
// './js/jquery.maskedinput.min.js',
// './js/modernizr.js',
// './js/custom.js',
'./js/main.js',
'./node_modules/node-reset-scss/scss/_reset.scss',
'./sass/style.scss'
],
output:
{
path: path.resolve(__dirname, 'build'),
filename: 'main.js',
},
module:
{
rules:
[
{
test: /\.scss$/,
use: ExtractTextPlugin.extract(
{
fallback: 'style-loader',
use: [
'css-loader?minimize','sass-loader?sourceMap']
// use: ['css-loader', 'sass-loader?sourceMap']
})
},
{
test: /\.(png|jpg)$/,
use: {
loader: 'file-loader',
options: {
name: './images/[name].[ext]', // check the path
}
}
}
]
},
resolve: {
extensions: ['*', '.js', '.scss'],
alias:
{
// 'scripts': path.resolve(__dirname, './js/modules/react/scripts.jsx')
// 'node_modules': path.join(__dirname, 'node_modules')
}
},
plugins:
[
new webpack.DefinePlugin({
'process.env':
{
NODE_ENV: JSON.stringify('production')
}
}),
new webpack.optimize.UglifyJsPlugin(),
new ExtractTextPlugin(
{
filename: '../style.css',
allChunks: true
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
})
]
};
module.exports = config;