In a project generated by vue-cli, how to build two sets of pages on both the mobile side and the PC side at the same time? where can you tell whether it is a PC or a mobile device?

can you provide some ideas, or an example project?
Thank you.

Apr.21,2021

refer to this
https://codeshelper.com/a/11.


npm run build:mobile

npm run build:pc
package.json

{
  "scripts": {
     "build:mobile": "webpack --config webpack.m.config.js",
     "build:pc": "webpack --config webpack.pc.config.js"
  }

}

then you extract the common configuration yourself and merge it through webpack-merge.

the configuration entries of mobile and pc are different, and what else is different needs to be decided according to your project.

Menu