0

次のようなwebpack.config.jsファイルがあります。

let webpack = require('webpack');

module.exports = {
    entry: './src/test.css',
    output: {
        path: "dist",
        filename: "app.js"
    },
    module: {
        loaders: [
            { test: /\.css$/, include: ["E:\demo\src"], loaders: ["style", "css"] }
        ]
    }
}

しかし、それは失敗しました。エラーメッセージは次のとおりです。

ERROR in ./src/test.css
Module parse failed: e:\demo\webpack-demo\src\test.css Unexpected token (1:4)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (1:4)
    at Parser.pp$4.raise (E:\demo\webpack-demo\node_modules\acorn\dist\acorn.js:2221:15)
    at Parser.pp.unexpected (E:\demo\webpack-demo\node_modules\acorn\dist\acorn.js:603:10)
    at Parser.pp.semicolon (E:\demo\webpack-demo\node_modules\acorn\dist\acorn.js:581:61)
    at Parser.pp$1.parseExpressionStatement (E:\demo\webpack-demo\node_modules\acorn\dist\acorn.js:966:10)
    at Parser.pp$1.parseStatement (E:\demo\webpack-demo\node_modules\acorn\dist\acorn.js:730:24)
    at Parser.pp$1.parseTopLevel (E:\demo\webpack-demo\node_modules\acorn\dist\acorn.js:638:25)
    at Parser.parse (E:\demo\webpack-demo\node_modules\acorn\dist\acorn.js:516:17)
    at Object.parse (E:\demo\webpack-demo\node_modules\acorn\dist\acorn.js:3098:39)
    at Parser.parse (E:\demo\webpack-demo\node_modules\webpack\lib\Parser.js:902:15)
    at DependenciesBlock.<anonymous> (E:\demo\webpack-demo\node_modules\webpack\lib\NormalModule.js:104:16)
    at DependenciesBlock.onModuleBuild (E:\demo\webpack-demo\node_modules\webpack-core\lib\NormalModuleMixin.js:310:10)
    at nextLoader (E:\demo\webpack-demo\node_modules\webpack-core\lib\NormalModuleMixin.js:275:25)
    at E:\demo\webpack-demo\node_modules\webpack-core\lib\NormalModuleMixin.js:259:5
    at Storage.finished (E:\demo\webpack-demo\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:38:16)
    at E:\demo\webpack-demo\node_modules\graceful-fs\graceful-fs.js:78:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3)

しかし、includeを削除すると成功です。私のファイルディレクトリは次のとおりです。

ここに画像の説明を入力

4

0 に答える 0