Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 编译sass加载程序后出现错误的图像url。网页2_Windows_Image_Url - Fatal编程技术网

Windows 编译sass加载程序后出现错误的图像url。网页2

Windows 编译sass加载程序后出现错误的图像url。网页2,windows,image,url,Windows,Image,Url,我已经在webpack2上编写了我的第一个构建系统。有人能帮我解决我的问题吗。我的配置有什么问题?我很抱歉我的英语不好。以下是一些屏幕照片和我的网页配置: `'use strict'; const webpack = require("webpack"); const ExtractTextPlugin = require("extract-text-webpack-plugin"); const IconfontWebpackPlugin = require('iconfont-webpac

我已经在webpack2上编写了我的第一个构建系统。有人能帮我解决我的问题吗。我的配置有什么问题?我很抱歉我的英语不好。以下是一些屏幕照片和我的网页配置:

`'use strict';

const webpack = require("webpack");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const IconfontWebpackPlugin = require('iconfont-webpack-plugin');
const SpritesmithPlugin = require('webpack-spritesmith');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');

const NODE_ENV = process.env.NODE_ENV || 'development'
const isDevelopment = NODE_ENV == 'development' ? true : false;

module.exports = {
    context: __dirname + "/source",

    entry: {
        main: "./static/js/main.js"
    },

    output: {
        path: __dirname + "/dist",
        filename: "/static/js/[name].js"
    },

    watch: true,

    watchOptions: {
        aggregateTimeout: 100
    },

    devtool: isDevelopment ? 'source-map' : null,

    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: [{
                    loader: "babel-loader",
                    options: { presets: ["es2015"] }
                }],
            },
            {
                test: /\.(png|jpg|svg|eot|woff|woff2|ttf)$/,
                exclude: /node_modules/,
                use: [{
                    loader: "file-loader",
                    options: {
                        name: '[path][name].[ext]'
                    }
                }],
            },
            {
                test: /\.html$/,
                exclude: /node_modules/,
                use: [{
                    loader: "file-loader",
                    options: {
                        name: '[name].[ext]'
                    }
                }],
            },
            {
                test: /\.scss$/,
                exclude: /node_modules/,
                use: ExtractTextPlugin.extract({
                    fallback: "style-loader",
                    loader: "css-loader!postcss-loader!sass-loader"
                }),
            }
        ]
    },

    plugins: [
        new webpack.NoEmitOnErrorsPlugin(),
        new webpack.optimize.CommonsChunkPlugin({
            name: "common",
            filename: "./static/js/common.js",
            minChunks: 2,
        }),
        new ExtractTextPlugin({
            filename: './static/css/styles.css', 
            disable: false, 
            allChunks: true 
        }),
        new SpritesmithPlugin({
            src: {
                cwd: __dirname + '/source/static/img/icons',
                glob: '*.png'
            },
            target: {
                image: __dirname + '/dist/static/img/sprite/sprite.png',
                css: __dirname + '/source/static/scss/_sprite.scss'
            },
            apiOptions: {
                cssImageRef: "/dist/static/img/sprite/sprite.png"
            }
        }),
        new BrowserSyncPlugin({
            host: 'localhost',
            port: 3000,
            server: { baseDir: ['dist'] }
        })
    ],
};`

控制台错误屏幕截图-

无错误的网页包构建可能对某人有帮助{test://\(png | jpg | svg | eot | woff | woff2 | ttf)$/,排除:/node|u模块/,使用:[{loader:“file loader”,选项:{name:'/[path][name].[ext“}}],},在name参数中添加“/”