2017-07-29 65 views
0

我使用Vue公司的aysnc部件用下面的代码:的WebPack束寻找在错误的位置2.bundle.js

Vue.component( 'async-webpack-example', () => import('./my-async-component') )

它建立精细的WebPack设法创造2.bundle.js

不幸的是,当加载文件时,它在根(http://example.com/2.bundle.js)中寻找2.bundle.js,而不是在它所在的http://example.com/js/2.bundle.js中寻找。

我需要一个webpack指令来解决这个问题吗?如果是这样,我需要什么样的指令?谢谢! :)

回答

0

没关系。我找到了答案。

在你webpack.config.js文件,

output: { 
    path: path.resolve(__dirname, './js'), 
    filename: '[name].bundle.js', 
    publicPath: './wp-content/themes/dist/js/' 
},