Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support MPA router #93

Closed
wants to merge 5 commits into from
Closed

support MPA router #93

wants to merge 5 commits into from

Conversation

TomVista
Copy link

@TomVista TomVista commented Apr 3, 2020

 const VueAutoRoutingPlugin = require('vue-auto-routing/lib/webpack-plugin')

module.exports = {
// ... other options ...

plugins: [
   new VueAutoRoutingPlugin([
      {
     pageName:'user',
     pages: 'src/pages/user',
     importPrefix: '@/pages/user'
    },{
     pageName:'shop',
     pages: 'src/pages/shop',
     importPrefix: '@/pages/shop'
    }
    ])
  ]
}

get this in /node_moudle/vue-auto-routing
-user.js
-shop.js
-index.js

and the vue-router

import { user,shop} from 'vue-auto-routing'

import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export{
   userRouter: new Router({
  mode: 'history',
  user
  }),
  shopRouter: new Router({
    mode: 'history',
    shop
  }),
} 

the main.js

import { userRouter} from 'xxx'
new Vue({
...
userRouter,
render: h => h(app),
...
})

ZHAOLEITAO and others added 3 commits April 3, 2020 11:46
add forked information to reademe
Copy link
Owner

@ktsn ktsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add test case for this change?

src/webpack-plugin.ts Show resolved Hide resolved
src/webpack-plugin.ts Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
lib/webpack-plugin.d.ts Outdated Show resolved Hide resolved
lib/webpack-plugin.js Outdated Show resolved Hide resolved

compiler.hooks.thisCompilation.tap(pluginName, compilation => {
try {
generate()
if (Object.prototype.toString.call(this.options) === '[object Object]') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (Object.prototype.toString.call(this.options) === '[object Object]') {
if (typeof this.options === 'object') {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe

typeof [1, 2, 4] === 'object';

typeof new Date() === 'object';

src/webpack-plugin.ts Outdated Show resolved Hide resolved
src/webpack-plugin.ts Show resolved Hide resolved
@TomVista
Copy link
Author

for the test,
i try to do ,but I haven't written it before,so.:dog

package.json Outdated Show resolved Hide resolved
@ktsn
Copy link
Owner

ktsn commented Jan 6, 2021

Sorry for the absence. I believe #149 would be better way to solve the original problem - you only need to pass multiple plugin instances with different output paths.

@ktsn ktsn closed this Jan 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants