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
- added es6-promise to fix polyfill issue — committed to gregkbarnes/blank-canvas by deleted user 9 years ago
- Downgrade css-loader to 0.18.0 See: https://github.com/webpack/css-loader/issues/144 — committed to moroshko/accessible-colors by moroshko 9 years ago
- Downgrade css loader to get around webpack error https://github.com/webpack/css-loader/issues/144 — committed to knewter/elixir_friends by knewter 9 years ago
- Downgrade css-loader dependency for Node 0.10.x compatibility. Running the build task under Node 0.10.x fails with the following error: > ERROR in ./~/css-loader!./~/sass-loader!./src/components/wid... — committed to iandunn/wp-react-boilerplate by iandunn 9 years ago
- Specify node engine minimum version Setting the minimum version of the node engine will make npm to warn or complain, if node `engine-strict` config is set to true, whenever the installation environm... — committed to dreyescat/css-loader by dreyescat 8 years ago
- add babel-polyfill in build process for css-loader i tried to run the build scripts on an ubuntu machine with an old install of node and hit an error due to Promise being undefined. https://github.c... — committed to tlicata/tic-tac-toe by tlicata 8 years ago
- webpack's css-loader requires Promise polyfill to work — committed to ryu1kn/done-map by ryu1kn 8 years ago
- Use newer css-loader use es6-promise as workaround for https://github.com/webpack/css-loader/issues/144 — committed to Opetushallitus/valtionavustus by deleted user 8 years ago
@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!
@AsaAyers https://github.com/jakearchibald/es6-promise#auto-polyfill
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 below0.12.0
:You are not supporting old versions but at least it is explicit which ones are.