Current file path in webpack

后端 未结 3 1899
时光说笑
时光说笑 2020-12-05 05:07

Is there any way to receive current file path, like in requirejs?

define([\'module\'], function (module) {
    console.log(module.uri)
});
3条回答
  •  一生所求
    2020-12-05 05:40

    To get the filename an the dir name I added this to the web pack config

    node : {
       __filename: true,
       __dirname: true,
    },
    

    setting the context to __dirname messed up my web pack config since I have my webpackconfig not placed in root but the paths are setup that way

提交回复
热议问题