diff --git a/examples/App.vue b/examples/App.vue new file mode 100644 index 000000000..b65964f0e --- /dev/null +++ b/examples/App.vue @@ -0,0 +1,26 @@ + + + diff --git a/examples/index.html b/examples/index.html new file mode 100644 index 000000000..926b1c727 --- /dev/null +++ b/examples/index.html @@ -0,0 +1,81 @@ + + + + + + + + + + + Ant Design Vue + + + + + + + +
+ + + + + + + diff --git a/examples/index.js b/examples/index.js new file mode 100644 index 000000000..2b0f85e96 --- /dev/null +++ b/examples/index.js @@ -0,0 +1,11 @@ +import 'babel-polyfill'; +import Vue from 'vue'; +import App from './App.vue'; +import { Button } from 'ant-design-vue'; + +Vue.use(Button); + +new Vue({ + el: '#app', + render: h => h(App), +}); diff --git a/package.json b/package.json index 51612cbfb..49f98e5b5 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "scripts" ], "scripts": { - "dev": "node build/dev.js", + "dev": "webpack-dev-server", "start": "cross-env PORT=3001 NODE_ENV=development webpack-dev-server --config build/webpack.dev.conf.js", "test": "cross-env NODE_ENV=test jest --config .jest.js", "compile": "node antd-tools/cli/run.js compile", @@ -109,7 +109,6 @@ "gulp": "^4.0.1", "gulp-babel": "^7.0.0", "gulp-strip-code": "^0.1.4", - "highlight.js": "^9.12.0", "html-webpack-plugin": "^3.2.0", "husky": "^4.0.0", "istanbul-instrumenter-loader": "^3.0.0", @@ -123,8 +122,6 @@ "less-loader": "^5.0.0", "less-plugin-npm-import": "^2.1.0", "lint-staged": "^10.0.0", - "markdown-it": "^10.0.0", - "markdown-it-anchor": "^5.0.0", "marked": "0.3.18", "merge2": "^1.2.1", "mini-css-extract-plugin": "^0.9.0", @@ -137,7 +134,6 @@ "postcss-loader": "^3.0.0", "prettier": "^1.18.2", "pretty-quick": "^2.0.0", - "prismjs": "^1.19.0", "querystring": "^0.2.0", "raw-loader": "^4.0.0", "reqwest": "^2.0.5", @@ -215,4 +211,4 @@ "lib/**/style/*", "*.less" ] -} +} \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 000000000..a7cf884b6 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,100 @@ +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const VueLoaderPlugin = require('vue-loader/lib/plugin'); +const webpack = require('webpack'); +const WebpackBar = require('webpackbar'); +const path = require('path'); + +module.exports = { + mode: 'development', + entry: { + app: './examples/index.js', + }, + module: { + rules: [ + { + test: /\.vue$/, + loader: 'vue-loader', + }, + { + test: /\.(js|jsx)$/, + loader: 'babel-loader', + options: { + presets: [ + [ + 'env', + { + targets: { + browsers: [ + 'last 2 versions', + 'Firefox ESR', + '> 1%', + 'ie >= 9', + 'iOS >= 8', + 'Android >= 4', + ], + }, + }, + ], + ], + plugins: [ + // libraryDirectory is "", because webpack alias doesn't seem to allow '/' + ['import', { libraryName: 'ant-design-vue', style: true, libraryDirectory: '' }], + 'transform-vue-jsx', + 'transform-object-assign', + 'transform-object-rest-spread', + 'transform-class-properties', + ], + }, + }, + { + test: /\.(png|jpg|gif|svg)$/, + loader: 'file-loader', + options: { + name: '[name].[ext]?[hash]', + }, + }, + { + test: /\.less$/, + use: [ + { loader: 'vue-style-loader' }, + { + loader: 'css-loader', + options: { sourceMap: true }, + }, + { loader: 'less-loader', options: { sourceMap: true, javascriptEnabled: true } }, + ], + }, + { + test: /\.css$/, + use: ['vue-style-loader', 'css-loader'], + }, + ], + }, + resolve: { + alias: { + 'ant-design-vue': path.join(__dirname, './components'), + }, + extensions: ['.js', '.jsx', '.vue'], + }, + devServer: { + host: 'localhost', + port: 3000, + historyApiFallback: { + rewrites: [{ from: /./, to: '/index.html' }], + }, + disableHostCheck: true, + hot: true, + open: true, + }, + devtool: '#source-map', + plugins: [ + new webpack.HotModuleReplacementPlugin(), + new HtmlWebpackPlugin({ + template: 'examples/index.html', + filename: 'index.html', + inject: true, + }), + new VueLoaderPlugin(), + new WebpackBar(), + ], +};