How can I achieve this with CommonChunPlugin from WebPack?

0

What happens is that I just saw a package made with webpack, which returns a function called webpackJsop that causes the javascript code to load asynchronously by chunks. This is the plugin link CommonChunkPlugin

This is the code returns once it is packaged and that I would like to be able to do:

webpackJsonp(["main"], {
    // main corresponde al archivo main.js
    "xyz": function() {
        // xyz corresponde a la ruta relativa del archivo main.js pero codificado en base64
        console.log("Hola mundo")
    }
})

The coding of file paths is achieved with this plugin HashedModulesPlugin

This is the code of main.js :

console.log("Hola mundo");

And when I try to do the same, just give me this back:

webpackJsopn([0], {
    "xyz": function() {
        console.log("Hola mundo")
    }
})

And as my question says, how could I achieve it as it appears in the first example code. I hope you can help me, and thank you for your patience and help. :)

    
asked by Eddy Otsutsuki 13.02.2018 в 05:43
source

0 answers