
本文共 3978 字,大约阅读时间需要 13 分钟。
���Vue-CLI2���������Vue-CLI4������������������������build���������config������������������������������������������������������������������������������������������������������������������������������������������
���������Vue-CLI2���Vue-CLI4���������������������������������������������������������������������������������
1. ������
- Vue-CLI2���
npm install -g vue-cli ��� cnpm install -g vue-cli
- Vue-CLI4���
npm install -g @vue/cli ��� cnpm install -g @vue/cli
2. ������
- Vue-CLI2���
npm uninstall -g vue-cli ��� cnpm uninstall -g vue-cli
- Vue-CLI4���
npm uninstall -g @vue/cli ��� cnpm uninstall -g @vue/cli
3. ������������
- Vue-CLI2���
vue init webpack my-project2
- Vue-CLI4���
vue create my-project4
4. ������������������
- Vue-CLI2���
- ������������������������������src���public���app���etc���������������
- Vue-CLI4���
- ���������������������������������������������������������������src���public���assests���������������
5. ������������
- Vue-CLI2���
npm run dev
- Vue-CLI4���
npm run serve
���������������������build���������config������������������������������������������������
6. ������������
���������������������vue.config.js
���������������������������������������������������������
module.exports = { // ������������������ publicPath: './', // ������������������ outputDir: '../dist', // ������������������ assetsDir: '../assests', // HTML������������ indexPath: '../index.html', // ��������������� filenameHashing: true, // ���������������������������`undefined` pages: { index: { entry: './src/index/main.js', template: './public/index.html', filename: 'index.html', title: 'Index Page', chunks: ['chunk-vendors', 'chunk-common', 'index'] }, // ������������������... }, // ESLint������ lintOnSave: true, // ������������������������������ runtimeCompiler: false, //'Brien/loader'������������node_modules transpileDependencies: [ /* ��������������������������������� */ ], // ������������������source map productionSourceMap: true, // HTML������������������������ crossorigin: "", // SRI������������������������ integrity: true, // ������webpack������ configureWebpack: () => {}, // ������webpack��������� chainWebpack: () => {}, // webpack-dev-server������ devServer: { open: process.platform === 'darwin', host: 'localhost', port: 8080, https: false, hotOnly: false, proxy: { '/api': { target: 'http://app.ly.com', changeOrigin: true, secure: false, pathRewrite: { '^/api': '' } }, '/foo': { target: 'other_url' } } }, // CSS������������ css: { extract: true, sourceMap: false, loaderOptions: { css: {}, postcss: {} }, modules: false }, // ������������������ pwa: {}, // ������������������ pluginOptions: { // ... }}
���vue.config.js
������������������������������������������Vue CLI������������������������������������������
������������������������vue.config.js
������������������������������
publicPath
���������������������������������������outputDir
������������������������������������pages
���������������������������������devServer
���������������������������������������������������������������������css
���������������������CSS������������������
7. ������������
- ������������������������������
vue.config.js
��������� - ������
package.json
������ slavery.clear���include������������������������������������������ - ������
npm run serve
������������������������������������������������������������������������
������������������������������������������������������������������������������������������
vue.config.js
���������������������������������������������������������������������Vue-CLI2���������Vue-CLI4���������������������������������������������������������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
