roman01la / webpack-closure-compiler

[DEPRECATED] Google Closure Compiler plugin for Webpack
MIT License
464 stars 25 forks source link

css loaders #11

Closed Maxlufs closed 8 years ago

Maxlufs commented 8 years ago

Hi, I have a case where in main.js, css is imported. So during the build, the setup looks like this

module: {
  loaders: [{
    test: /\.css$/,
    include: [POSTCSS_SRC_DIR],
    loader: ExtractTextPlugin.extract('style', 'css?root=..!postcss')
  },{
    test: /\.js$/,
    include: [JS_SRC_DIR],
    loader: 'babel-loader'
  }]
},
plugins: [
      new ClosureCompilerPlugin({
      compiler: {
        language_in: 'ECMASCRIPT6',
        language_out: 'ECMASCRIPT5_STRICT',
        compilation_level: 'ADVANCED',
      },
      concurrency: 3,
    })
]

And it gives me error:

ERROR in ./src/css/main.css
Module build failed: TypeError: text.forEach is not a function

seems like the plugin doesn't take any non js files extracted by ExtractTextPlugin. Is there any way to ignore css files or work around this issue?

Thank you!

DekusDenial commented 8 years ago

having the same issue here~~

roman01la commented 8 years ago

Fixed and published as v2.0.2. I've added test option where you can specify a pattern for file names which should be processed, default is /\.js($|\?)/i.

        new ClosureCompilerPlugin({
          test: /\.js($|\?)/i,
          compiler: {
            language_in: 'ECMASCRIPT6',
            language_out: 'ECMASCRIPT5',
            compilation_level: 'ADVANCED'
          },
          concurrency: 3,
        })