2016-05-22 5 views
1

私はマテリアルデザインライトからCSSファイルを圧縮したいのですが、私はこのようにそれをインポートする場合のWebPACKはmaterial.cssファイルを参照していません。材料設計Liteは反応し、WebPACKの

import 'material-design-lite'; 

しかし、私はしようとしたとき、インポートは、直接このようmaterial.css:

import 'material-design-lite/material.css'; 

は、私が持っている:ここで

ERROR in ./~/material-design-lite/material.css 
Module parse failed: /p/prod/node_modules/material-design-lite/material.css Unexpected character '@' (8:0) 

は私のWebPACKのconfファイルのワットでありますebpack.base.js:

var path = require("path") 
var webpack = require('webpack') 
var BundleTracker = require('webpack-bundle-tracker') 
var ExtractTextPlugin = require("extract-text-webpack-plugin"); 
var cssPath = path.join(__dirname, 'assets/css'); 

module.exports = { 
    context: __dirname, 

    entry: './assets/js/index', 

    output: { 
     path: path.resolve('./assets/bundles/'), 
     filename: "[name]-[hash].js" 
    }, 

    plugins: [ 
     new ExtractTextPlugin("[name]-[hash].css") 
    ], 

    module: { 
     loaders: [ 
      { 
       test: /\.jsx?$/, 
       exclude: /node_modules/, 
       loaders: ['react-hot', 'babel?presets[]=react,presets[]=es2015,presets[]=stage-0'], 
      }, { 
       test: /\.css$/, 
       exclude: /node_modules/, 
       loader: ExtractTextPlugin.extract("style-loader", "css-loader") 
      } 
     ], 
    }, 

    resolve: { 
     modulesDirectories: ['node_modules', cssPath], 
     extensions: ['', '.js', '.jsx', '.css'] 
    }, 
} 

誰かが私が間違っていたアイデアを持っていますか?

答えて

1

問題は、あなたのスタイルとCSSのロード用node_modulesを無視していることである - とCSSファイルがnode_modules

+0

である通常のCSSファイルのように見えます。これは8行目です: '@charset" UTF-8 ";' – Kijek

+0

は私の答えを変えました - かなり確かにthatsの問題 – Marty

+0

OMG!あなたは正しい!ありがとう! – Kijek

関連する問題