Not working if node version<12
Closed this issue ยท 2 comments
Hi! Thanks for creating this plugin - it's very helpful as an interim solution ๐
For the issue, I'm getting an error related to parsing when using the webpack plugin, maybe something to do with the regexes the plugin uses:
code.matchAll(...) is not a function or its return value is not iterable
I'm using r113, but it looks like this is also happening with the supported revision (r112 I assume as it is listed in package.json
).
I am able to reproduce this with a minimal webpack.config.js
:
const ThreeMinifierResolver = require('@yushijinhun/three-minifier-webpack');
const threeMinifier = new ThreeMinifierResolver();
module.exports = {
entry: './index.js',
plugins: [ threeMinifier ],
output: {
filename: 'bundle.js',
},
resolve: {
plugins: [ threeMinifier.resolver ],
},
};
And minimal index.js
:
import { WebGLRenderer } from 'three';
console.log(WebGLRenderer);
I can't reproduce this error. Are you using the latest version of three-minifier?
This works fine for me:
"devDependencies": {
"@yushijinhun/three-minifier-webpack": "^0.1.4",
"webpack-cli": "^3.3.11"
},
"dependencies": {
"three": "^0.113.2"
}
It looks like this is due to the version of node I was using. The plugin uses string.matchAll
which requires node.js 12.0+. The plugins works as expected once I updated node to 12.0.
I think a note about the required node version in the readme will help in case anyone else runs into this issue.