DWQA QuestionsCategory: ProgramHow does webpack split code into folders?
xiguadada asked 1 month ago
const Home = resolve => {
  require.ensure(['./views/Home.vue'], () => {
    resolve(require('./views/Home.vue'));
  }, 'my_home');
};

The split file path is build/0.my_home.[hash].js

const Home = resolve => {
  require.ensure(['./views/Home.vue'], () => {
    resolve(require('./views/Home.vue'));
  }, 'js/my_home');
};

The split file path is build/0.js/my_home.[hash].js
But I want build/js/my_home.[hash]. Js, the default code segmentation always adds 0 before my name.

1 Answers
Best Answer
array_huang answered 1 month ago

It should be yoursoutput.chunkFilenameThe parameters are not well matched. Please paste your entire output parameter to have a look

xiguadada replied 1 month ago

Sure enough, set chunkFilename:[name].[hash]. Js is good, thank you, has been adopted.