用 webpack 建立 vue 專案
1、安裝支援webpack 包
npm i -D webpack webpack-cli aspnet-webpack webpack-dev-middleware webpack-hot-middleware clean-webpack-plugin html-webpack-plugin
2、支援 babel ES2017
npm i -D @babel/core @babel/cli @babel/preset-env @babel/plugin-transform-runtime babel-loader
npm i @babel/runtime @babel/polyfill @babel/plugin-syntax-dynamic-import
配置為:
"babel": { "presets": [ [ "@babel/preset-env", { "targets": { "esmodules": false } } ] ], "plugins": [ "@babel/plugin-transform-runtime","@babel/plugin-syntax-dynamic-import" ] }
3、支援各種檔案型別載入
npm i -D cache-loader file-loader html-loader postcss-loader style-loader svg-sprite-loader text-loader url-loader
4、sass 檔案型別
npm i -D node-sass sass-loader
5、element-ui 支援
npm i vue vuex vue-router element-ui axios
npm i -D vue-cli vue-loader vue-template-compiler
6、各種 vue 外掛
npm i vue-grid-layout vue-i18n vue-json-tree-view vue-splitpane vue-router screenfull file-saver hotkeys-js dayjs
7、繼續外掛
npm i @d2-projects/d2-crud better-scroll clipboard-polyfill echarts nprogress lodash lowdb