diff --git a/README.md b/README.md index 26f0428..7eb7fce 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,6 @@ # vue2-vue-router2-webpack3 ## Blog -《从零搭建vue2+vue-router2+webpack3工程》 +《搭建 vue2 vue-router2 webpack3 多入口工程》 场景一 -[http://www.qinshenxue.com/article/20161118151423.html](http://www.qinshenxue.com/article/20161118151423.html) - -## Demo - -[https://qinshenxue.github.io/vue2-vue-router2-webpack2/](https://qinshenxue.github.io/vue2-vue-router2-webpack2/) +[http://www.qinshenxue.com/article/20171102091836.html](http://www.qinshenxue.com/article/20171102091836.html) diff --git a/build/dev.js b/build/dev.js index f0c42af..282bc03 100644 --- a/build/dev.js +++ b/build/dev.js @@ -6,6 +6,12 @@ var compiler = webpack(devConfig); var server = new webpackDevServer(compiler, { hot: true, quiet: true, + historyApiFallback: { + rewrites: [ + { from: /^\/web/, to: '/web/index.html' }, + { from: /^\/admin/, to: '/admin/index.html' } + ] + }, publicPath: config.dev.outputPublicPath, stats: { colors: true } }); diff --git a/build/utils.js b/build/utils.js index c599086..d40c05e 100644 --- a/build/utils.js +++ b/build/utils.js @@ -70,7 +70,7 @@ exports.genHtmlPlugins = function () { Object.keys(baseWebpackConfig.entry).forEach(function (name) { plugins.push( new HtmlWebpackPlugin({ - filename: isProd ? path.resolve(__dirname, `../dist/${name}/index.html`) : name + '.html', + filename: isProd ? path.resolve(__dirname, `../dist/${name}/index.html`) : `${name}/index.html`, template: 'index.tpl.html', chunks: isProd ? ['manifest','vendor',`${name}-vendor`, name] : [name], inject: true diff --git a/src/admin/router.js b/src/admin/router.js index 90b8f00..4285a47 100644 --- a/src/admin/router.js +++ b/src/admin/router.js @@ -1,11 +1,13 @@ import index from './views/index.vue' import table from './views/table.vue' export default { + base: process.env.NODE_ENV === "production" ? '/' : '/admin/', + mode: 'history', linkActiveClass: 'active', routes: [{ path: '/', component: index - },{ + }, { path: '/table', component: table }] diff --git a/src/web/router.js b/src/web/router.js index 79bc7ac..3965772 100644 --- a/src/web/router.js +++ b/src/web/router.js @@ -6,6 +6,8 @@ import sass from './views/sass.vue' import image from './views/image.vue' import iconfont from './views/iconfont.vue' export default { + base: process.env.NODE_ENV === "production" ? '/' : '/web/', + mode: 'history', linkActiveClass: 'active', routes: [{ path: '/',

AltStyle によって変換されたページ (->オリジナル) /