Answer the question
In order to leave comments, you need to log in
How to transform js code for old version of node.js?
I am using the following webpack config.
Babel preset set to node.js 6.10 compatibility mode
const path = require('path');
module.exports = {
entry: './src/index.js',
module: {
rules: [
{
test: /\.(js)$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', {
targets: {
node: '6.10'
}
}]
}
}
}
]
},
output: {<code lang="javascript">
</code>
path: path.resolve(__dirname, 'dist'),
filename: 'index_bundle.js'
},
mode: 'production'//process.env.NODE_ENV === 'production' ? 'production' : 'development'
}
const promise1 = Promise.resolve(3);
const promise2 = new Promise((resolve, reject) => setTimeout(reject, 100, 'foo'));
const promises = [promise1, promise2];
Promise.allSettled(promises).
then((results) => results.forEach((result) => console.log(result.status)));
(()=>{var e=[Promise.resolve(3),new Promise((function(e,o){return setTimeout(o,100,"foo")}))];Promise.allSettled(e).then((function(e){return e.forEach((function(e){return console.log(e.status)}))}))})();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question