css-loader: Promise is not defined error in 0.19.0

Latest release is failing builds for me, seeing the error below in 0.19.0. This error is not present in 0.18.0.

ERROR in ./~/css-loader!./app/main.css
Module build failed: ReferenceError: Promise is not defined
    at LazyResult.async (/Users/chris/IdeaProjects/SW2.0/survivejs/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:152:31)
    at LazyResult.then (/Users/chris/IdeaProjects/SW2.0/survivejs/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:75:21)
    at processCss (/Users/chris/IdeaProjects/SW2.0/survivejs/node_modules/css-loader/lib/processCss.js:174:5)
    at Object.module.exports (/Users/chris/IdeaProjects/SW2.0/survivejs/node_modules/css-loader/lib/loader.js:22:2)
 @ ./app/main.css 4:14-75 13:2-17:4 14:20-81

Here’s the webpack config:

var path = require('path');
var HtmlwebpackPlugin = require('html-webpack-plugin');
var webpack = require('webpack');

var ROOT_PATH = path.resolve(__dirname);

module.exports = {
  entry: path.resolve(ROOT_PATH, 'app'),
  output: {
    path: path.resolve(ROOT_PATH, 'build'),
    filename: 'bundle.js'
  },
  devtool: 'eval-source-map',
  devServer: {
    historyApiFallback: true,
    hot: true,
    inline: true,
    progress: true
  },
  module: {
    loaders: [
      {
        test: /\.css$/,
        loaders: ['style', 'css'],
        include: path.resolve(ROOT_PATH, 'app')
      }
    ]
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new HtmlwebpackPlugin({
      title: 'Kanban app'
    })
  ]
};

And package.json:

{
  "name": "survivejs",
  "version": "0.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "webpack-dev-server",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "css-loader": "^0.19.0",
    "html-webpack-plugin": "^1.6.1",
    "node-libs-browser": "^0.5.3",
    "style-loader": "^0.12.4",
    "webpack": "^1.12.2",
    "webpack-dev-server": "^1.11.0"
  }
}

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 23 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@bebraw PostCSS 5.0 does not support node 0.10, but you can polyfill the Promise API yourself:

https://github.com/jakearchibald/es6-promise

Thank you, @ben-eb!

Add to webpack.config.js require(‘es6-promise’).polyfill();

and it’s now working!

If it is an old node version issue it could be solved setting a minimal engine version in the package.json.

For example, adding the following field to the package.json file would prevent installing this module on environments with node versions below 0.12.0:

"engines": {
  "node": ">=0.12.0"
}

You are not supporting old versions but at least it is explicit which ones are.