我有 react-css-modules 使用 webpack 在我的应用程序上工作,它使用我提供的 ExtractTextPlugin 生成编译的 .css 文件。一切正常,但我坚持如何让它与业力/茉莉花一起工作?
当在 webpack 上构建时未发生此错误时,我不断收到 CSS Module is undefined 。
这是我的业力配置,唯一的区别是我不使用 ExtractTextPlugin
即因为test: /(((activityFeed|fonts)\.css)|(grids-core\.css)|(grids-responsive\.css))$/
我有loader: ['style', 'css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]']
var webpackConfigModified = {
devtool: 'inline-source-map',
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
loose: ['all'],
modules: 'commonStrict',
optional: ['runtime', 'minification.propertyLiterals']
}
},
{
test: /(\.css)$/,
exclude: ['./node_modules/purecss/build', './app/client/main/stylesheets'],
loader: 'style!css'
},
{
test: /(((activityFeed|fonts)\.css)|(grids-core\.css)|(grids-responsive\.css))$/,
include: ['./node_modules/purecss/build', './app/client/main/stylesheets'],
loader: ['style', 'css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]']
},
{
test: /underscore(?:-min)?\.js$/,
loader: 'expose?underscore'
},
{
test: require.resolve('lodash'),
loader: 'expose?lodash'
},
{
test: /\.json$/,
loader: 'json-loader'
}
],
noParse: []
},
plugins: [],
externals: {
jsdom: 'window',
cheerio: 'window',
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': 'window',
'text-encoding': 'window'
},
resolve: {
extensions: ['', '.js', '.json', '.css', '.scss'],
alias: {
'purecss/build/grids-responsive.css': path.resolve('./node_modules', 'purecss/build/grids-responsive.css'),
'purecss/build/grids-core.css': path.resolve('./node_modules', 'purecss/build/grids-core.css')
},
fallback: path.resolve('./app/client/'),
}
};
config.set({
basePath: '',
frameworks: ['jasmine-ajax', 'jasmine'],
files: [
{ pattern: 'app/client/spec/**/*.spec.js', watched: true, served: true, included: true },
],
preprocessors: {
'./app/client/spec/**/*.spec.js': ['webpack']
},
exclude: [
],
webpack: webpackConfigModified,
webpackServer: {
noInfo: true,
stats: 'errors-only'
},
plugins: [
'karma-*'
],
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
autoWatchBatchDelay: 800,
browsers: ['Chrome', 'Firefox'],
singleRun: false
});