Skip to content

Commit

Permalink
[Build] use vue-cli to build site (#3734)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Jul 3, 2019
1 parent 53e9468 commit 66459df
Show file tree
Hide file tree
Showing 30 changed files with 7,776 additions and 1,304 deletions.
4 changes: 2 additions & 2 deletions build/build-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const tasks = [
'node build/build-components.js --color',
'node build/build-style.js',
'node build/build-style-entry.js',
'cross-env NODE_ENV=production webpack --color --config build/webpack.build.js',
'cross-env NODE_ENV=production webpack -p --color --config build/webpack.build.js'
'cross-env NODE_ENV=production webpack --color --config build/webpack.config.js',
'cross-env NODE_ENV=production webpack -p --color --config build/webpack.config.js'
];

tasks.forEach(task => {
Expand Down
20 changes: 14 additions & 6 deletions build/webpack.build.js → build/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
const path = require('path');
const config = require('./webpack.dev.js');

const isMinify = process.argv.indexOf('-p') !== -1;

delete config.serve;

module.exports = Object.assign(config, {
module.exports = {
mode: 'production',
entry: {
vant: './es/index.js'
Expand All @@ -26,8 +23,19 @@ module.exports = Object.assign(config, {
amd: 'vue'
}
},
performance: false,
optimization: {
minimize: isMinify
},
resolve: {
extensions: ['.js', '.ts', '.tsx']
},
module: {
rules: [
{
test: /\.(js|ts|tsx)$/,
exclude: /node_modules/,
use: 'babel-loader'
}
]
}
});
};
91 changes: 0 additions & 91 deletions build/webpack.dev.js

This file was deleted.

14 changes: 0 additions & 14 deletions build/webpack.doc.js

This file was deleted.

166 changes: 0 additions & 166 deletions docs/site/DocsApp.vue

This file was deleted.

18 changes: 0 additions & 18 deletions docs/site/index.tpl

This file was deleted.

9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
],
"scripts": {
"bootstrap": "yarn || npm i",
"dev": "npm run build:entry && webpack-dev-server --config build/webpack.dev.js",
"dev": "npm run build:entry && cd site && yarn serve",
"lint": "eslint ./src --ext .js,.vue,.ts,.tsx && stylelint \"src/**/*.less\" --fix",
"build:entry": "node build/build-entry.js",
"build:changelog": "vant-doc changelog ./docs/markdown/changelog.generated.md --tag 2.0.0",
"build:lib": "node build/build-lib.js",
"build:site": "rm -rf docs/dist && cross-env NODE_ENV=production webpack --config build/webpack.doc.js && gh-pages -d docs/dist --add",
"build:site": "rm -rf site/dist && cd site && npm run build && gh-pages -d dist --add",
"test": "jest",
"test:watch": "jest --watch",
"test:clear-cache": "jest --clearCache",
Expand Down Expand Up @@ -89,7 +89,6 @@
"eslint": "^6.0.1",
"fast-glob": "^3.0.3",
"gh-pages": "^2.0.1",
"html-webpack-plugin": "3.2.0",
"husky": "^3.0.0",
"jest": "^24.8.0",
"jest-serializer-vue": "^2.0.2",
Expand All @@ -98,7 +97,6 @@
"lint-staged": "^9.0.0",
"postcss": "^7.0.17",
"postcss-loader": "^3.0.0",
"progress-bar-webpack-plugin": "^1.12.1",
"shelljs": "^0.8.3",
"signale": "^1.4.0",
"style-loader": "^0.23.1",
Expand All @@ -118,8 +116,7 @@
"vue-template-compiler": "2.6.10",
"vue-template-es2015-compiler": "^1.9.1",
"webpack": "4.35.2",
"webpack-cli": "^3.3.5",
"webpack-dev-server": "3.7.2"
"webpack-cli": "^3.3.5"
},
"sideEffects": [
"es/**/style/*",
Expand Down
3 changes: 3 additions & 0 deletions site/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['@vue/app']
};
Loading

0 comments on commit 66459df

Please sign in to comment.