N
N
Nik17122018-02-13 21:21:43
webpack
Nik1712, 2018-02-13 21:21:43

How to set up webpack for a regular mvc site so that scripts like vue and styles get static names?

There is a regular site for an online store. It is necessary to implement part of the functionality, like SPA - for example, a basket, a personal account on vue.js.
At the same time, some pages require only postcss and jquery. In a normal build, vue cli writes the paths to the scripts in index.html, each time generating new names for the js and css files.
How do I get webpack to bundle js and css with hard-coded names that can be specified in the js include path?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OKyJIucT, 2018-02-14
@OKyJIucT

// webpack.config.js

module.exports = {
    entry: {
        "name1111": "./js/file1.js",
        "sobaka912": "./js/file2.js",
    },
    output: {
        path: path.join(__dirname, './dist/js'),
        filename: "[name].js"
    },
};

the output will
be /dist/js/name1111.js
/dist/js/sobaka912.js

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question