请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

一引入antd的样式就报错 import 'antd/dist/antd.css';

报错

bundle.js:67347 Uncaught Error: Module parse failed: Unexpected character '@' (14:0)

You may need an appropriate loader to handle this file type.

| /* stylelint-disable declaration-bang-space-before,no-duplicate-selectors */

| /* stylelint-disable at-rule-no-unknown */

| @font-face {

|   font-family: "Helvetica Neue For Number";


正在回答 回答被采纳积分+3

插入代码

3回答

提问者 慕工程8751554 2018-01-02 16:42:09
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
var webpack =require('webpack');
var path= require('path');
 
module.exports={
 
    context:__dirname+'/src',
    entry:"./js/root.js",
    module:{
        loaders:[
            {
                test:/\.js?$/,
                exclude:/(node_modules)/,
                loader:'babel-loader',
                query:{
                    presets:['react','es2015']
                }
            },
            {
                test:/\.css$/,
                loader:'style!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]__[hash:base64:5]'
            }
        ]
    },
    output:{
        path:__dirname+"/src",
        filename:"bundle.js"
    },
    devServer: {
            host: '127.0.0.1',
            port: 8888,
            //contentBase: 'dist/',
            historyApiFallback: true
    }
};


0 回复 有任何疑惑可以回复我~
  • Parry #1
    https://github.com/ParryQiu/IMOOC-React/blob/master/react-router-4_webpack-2-CP22/webpack.config.js
    回复 有任何疑惑可以回复我~ 2018-01-02 16:51:21
  • 提问者 慕工程8751554 回复 Parry #2
    已解决 多谢
    回复 有任何疑惑可以回复我~ 2018-01-02 17:17:18
Parry 2018-01-02 16:09:27

webpack 怎么配置 loader 的?可以贴下截图吗?

0 回复 有任何疑惑可以回复我~
提问者 慕工程8751554 2018-01-02 15:56:47

antd引入正常。去掉样式, 可以运行。

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号