Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

Commit 357ebca

Browse files
committed
增加只编译组件的文件
1 parent 388ad85 commit 357ebca

File tree

11 files changed

+113
-156
lines changed

11 files changed

+113
-156
lines changed

README.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,3 @@
99
> Vue.js(v2.20+)
1010
1111
> Bootstrap(v4.0.0+) 推荐使用 `Bootstrap-Vue`
12-
13-
## Build Setup
14-
15-
``` bash
16-
# install dependencies
17-
npm install # yarn
18-
19-
# serve with hot reload at localhost:8080
20-
npm run dev
21-
22-
# build for production with minification
23-
npm run build
24-
25-
# build for production and view the bundle analyzer report
26-
npm run build --report
27-
```

build/build.component.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
'use strict'
2+
require('./check-versions')()
3+
4+
process.env.NODE_ENV = 'production'
5+
6+
const ora = require('ora')
7+
const rm = require('rimraf')
8+
const path = require('path')
9+
const chalk = require('chalk')
10+
const webpack = require('webpack')
11+
const config = require('../config')
12+
const webpackConfig = require('./webpack.prod.conf')
13+
14+
const spinner = ora('building for production...')
15+
16+
config.build.assetsSubDirectory = '/'
17+
18+
// webpackConfig.output = {
19+
20+
// }
21+
22+
spinner.start()
23+
24+
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
25+
if (err) throw err
26+
webpack(webpackConfig, (err, stats) => {
27+
spinner.stop()
28+
if (err) throw err
29+
process.stdout.write(stats.toString({
30+
colors: true,
31+
modules: false,
32+
children: false, // if you are using ts-loader, setting this to true will make typescript errors show up during build
33+
chunks: false,
34+
chunkModules: false
35+
}) + '\n\n')
36+
37+
if (stats.hasErrors()) {
38+
console.log(chalk.red(' Build failed with errors.\n'))
39+
process.exit(1)
40+
}
41+
42+
console.log(chalk.cyan(' Build complete.\n'))
43+
console.log(chalk.yellow(
44+
' Tip: built files are meant to be served over an HTTP server.\n' +
45+
' Opening index.html over file:// won\'t work.\n'
46+
))
47+
})
48+
})

build/webpack.base.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const createLintingRule = () => ({
2222
module.exports = {
2323
context: path.resolve(__dirname, '../'),
2424
entry: {
25-
app: ['babel-polyfill', './src/main.js']
25+
app: './src/main.js'
2626
},
2727
output: {
2828
path: config.build.assetsRoot,

config/index.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,7 @@ module.exports = {
1010
// Paths
1111
assetsSubDirectory: 'static',
1212
assetsPublicPath: '/',
13-
proxyTable: {
14-
'/api': {
15-
target: '\"\"',
16-
changeOrigin: true,
17-
changeOrigin: {
18-
'^/api': 'api'
19-
}
20-
}
21-
},
13+
proxyTable: {},
2214

2315
// Various Dev Server settings
2416
host: 'localhost', // can be overwritten by process.env.HOST

package.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "Vue component---vue-bootstrap-selectpicker",
55
"author": "long.woo <longwunet@outlook.com>",
66
"license": "MIT",
7+
"main": "dist/vue-bootstrap-selectpicker.min.js",
78
"repository": {
89
"type": "git",
910
"url": "https://github.com/long-woo/vue-bootstrap-selectpicker"
@@ -34,14 +35,8 @@
3435
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
3536
"start": "npm run dev",
3637
"lint": "eslint --ext .js,.vue src",
37-
"build": "node build/build.js"
38-
},
39-
"dependencies": {
40-
"bootstrap": "^4.1.1",
41-
"nprogress": "^0.2.0",
42-
"prismjs": "^1.15.0",
43-
"vue": "^2.5.2",
44-
"vue-router": "^3.0.1"
38+
"build": "node build/build.js",
39+
"build-component": "node build/build.component.js"
4540
},
4641
"devDependencies": {
4742
"autoprefixer": "^7.1.2",
@@ -52,9 +47,9 @@
5247
"babel-plugin-syntax-jsx": "^6.18.0",
5348
"babel-plugin-transform-runtime": "^6.22.0",
5449
"babel-plugin-transform-vue-jsx": "^3.5.0",
55-
"babel-polyfill": "^6.26.0",
5650
"babel-preset-env": "^1.3.2",
5751
"babel-preset-stage-2": "^6.22.0",
52+
"bootstrap": "^4.1.1",
5853
"chalk": "^2.0.1",
5954
"copy-webpack-plugin": "^4.0.1",
6055
"css-loader": "^0.28.0",
@@ -78,12 +73,15 @@
7873
"postcss-import": "^11.0.0",
7974
"postcss-loader": "^2.0.8",
8075
"postcss-url": "^7.2.1",
76+
"prismjs": "^1.15.0",
8177
"rimraf": "^2.6.0",
8278
"semver": "^5.3.0",
8379
"shelljs": "^0.7.6",
8480
"uglifyjs-webpack-plugin": "^1.1.1",
8581
"url-loader": "^0.5.8",
82+
"vue": "^2.5.2",
8683
"vue-loader": "^13.3.0",
84+
"vue-router": "^3.0.1",
8785
"vue-style-loader": "^3.0.1",
8886
"vue-template-compiler": "^2.5.2",
8987
"webpack": "^3.6.0",

src/assets/logo.png

-6.69 KB
Binary file not shown.

src/main.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import Vue from 'vue'
44
import App from './App'
55
import router from './router'
6-
// Nprogress
7-
import Nprogress from 'nprogress'
86

97
import 'bootstrap/dist/css/bootstrap.min.css'
108

@@ -15,8 +13,6 @@ import SelectPicker from './components'
1513

1614
Vue.config.productionTip = false
1715

18-
// use
19-
Vue.nprogress = Vue.prototype.$nprogress = Nprogress
2016
Vue.prototype.$prism = Prism
2117
Vue.use(SelectPicker)
2218

src/store/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/utils/event-bus.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/utils/http.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)