Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.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
Reactjs 网页包手写笔加载程序isn';无法分析React组件中的.styl文件_Reactjs_Webpack_Stylus_Webpack Dev Server_Webpack Style Loader - Fatal编程技术网

Reactjs 网页包手写笔加载程序isn';无法分析React组件中的.styl文件

Reactjs 网页包手写笔加载程序isn';无法分析React组件中的.styl文件,reactjs,webpack,stylus,webpack-dev-server,webpack-style-loader,Reactjs,Webpack,Stylus,Webpack Dev Server,Webpack Style Loader,Webpack dev server向我提供了以下错误: ERROR in ./src/styles/header.styl Module parse failed: /Users/andrew_krueger/code/portal/src/styles/header.styl Unexpected token (1:0) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected t

Webpack dev server向我提供了以下错误:

ERROR in ./src/styles/header.styl
Module parse failed: /Users/andrew_krueger/code/portal/src/styles/header.styl Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (1:0)
因此,在我看来,我的
触控笔加载程序配置不正确,或者有问题

文件结构

.
├── LICENSE
├── README.md
├── build
│   └── bundle.js
├── index.html
├── package.json
├── src
│   ├── components
│   │   ├── Canvas.jsx
│   │   ├── Container.jsx
│   │   ├── Header.jsx
│   │   └── Portal.jsx
│   ├── main.jsx
│   └── styles
│       └── header.styl
├── webpack.config.js
└── webpack.config.production.js
网页包配置

const Visualizer = require('webpack-visualizer-plugin')

module.exports = {
    plugins: [
        new Visualizer()
    ],
    devtool: 'eval-source-map',
    entry: './src/main.jsx',
    output: {
        path: './build',
        filename: 'bundle.js'
    },
    module: {
        preloaders: [{
            test: /\.jsx?$/,
            exclude: /node_modules/,
            loader: 'eslint'
        }],
        loaders: [{
            test: /\.jsx?$/,
            exclude: /node_modules/,
            loader: 'babel'
        },
        {
            test: /\.styl$/,
            exclude: /node_modules/,
            loaders: ['style', 'css', 'stylus']
        }]
    },
}
{
  test: /\.css$/,
  exclude: /node_modules/,
  loaders: ['style', 'css']
}
标题.styl

.green
    color: green
.green {
    color: green
};
Header.jsx

import React from 'react'

require('../styles/header.styl')

const Header = () =>
    <div className="green">Header</div>

export default Header
require('../styles/header.css')
标题.styl

.green
    color: green
.green {
    color: green
};
Header.jsx

import React from 'react'

require('../styles/header.styl')

const Header = () =>
    <div className="green">Header</div>

export default Header
require('../styles/header.css')
节点模块

├── autoprefixer@6.3.7
├── ava@0.15.2
├── babel-loader@6.2.4
├── babel-preset-es2015@6.9.0
├── babel-preset-react@6.11.1
├── css-loader@0.23.1
├── UNMET PEER DEPENDENCY eslint@3.2.0
├── eslint-config-airbnb@9.0.1
├── eslint-loader@1.5.0
├── eslint-plugin-import@1.12.0
├── UNMET PEER DEPENDENCY eslint-plugin-jsx-a11y@2.0.1
├── eslint-plugin-react@5.2.2
├── extract-text-webpack-plugin@1.0.1
├── jeet@6.1.4
├── postcss-loader@0.9.1
├── precss@1.4.0
├── react@15.3.0
├── react-dom@15.3.0
├── style-loader@0.13.1
├── stylus@0.54.5
├── stylus-loader@2.1.2
├── webpack@1.13.1
├── webpack-dev-server@1.14.1
├── webpack-visualizer-plugin@0.1.5
└── yeticss@7.3.0

很抱歉问您这个问题,但是您确定
触控笔加载程序
节点单元
中吗?您好,我想是的。我已经将顶级节点模块添加到OP中。然后不知道,对不起,我觉得一切正常。检查我的答案-这是一个解决方案,很抱歉这个问题,但是你确定
触控笔加载程序
节点模块中吗?嗨,是的,我相信是这样。我已经将顶级节点模块添加到OP。然后不知道,抱歉,我觉得一切正常。检查我的答案-这是您的解决方案