When webpack is packaged, babel does not transfer the files one layer above the startup directory.

both class are the same file

class hui{
    constructor(){

    }
    log=function(){
        console.log(123)
    }
}
var h = new hui();
h.log();

export default hui;

contents of test.js

require("../searchWidget/class")
require("./class");

when I execute webpack in the current directory of test.js, the first require will report an error in syntax, but not at the same level. Do you want to know where the limitation of the directory is set

clipboard.png

.babelrc configuration is fine

{
"presets": ["env","es2015" ,"stage-2"],
  "plugins": ["transform-class-properties"]
}
Jun.10,2021
Has the problem of

been solved later?

Menu