别看了,没啥用,现在出了Vue-cli官方脚手架工具,你们看下面这个链接,创建Vue.js项目吧!简单又快!

https://blog.csdn.net/assiduous_me/article/details/89208649

创建目录dist,src目录,src目录下创建main.js,index.html
npm init -y
cnpm i webpack -D
cnpm i webpack-dev-server -D
cnpm i html-webpack-plugin -D
cnpm i style-loader css-loader -D
cnpm i less-loader less -D
cnpm i sass-loader node-sass -D
cnpm i url-loader file-loader -D
cnpm i bootstrap@3 -S
cnpm i babel-loader @babel/core @babel/preset-env -D
cnpm i @babel/runtime @babel/plugin-transform-runtime -D
cnpm i @babel/plugin-proposal-class-properties -D
创建 webpack.config.js
内容:
var path = require("path");
var htmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
  entry: path.join(__dirname, "./src/main.js"),
  output: {
    path: path.join(__dirname, "./dist"),
    filename: "bundle.js"
  },
  plugins: [
    new htmlWebpackPlugin({
      template: path.join(__dirname, "./src/index.html"),
      filename: "index.html"
    })
  ],
  module: {
    rules: [
      { test: /\.css$/, use: ["style-loader", "css-loader"] },
      { test: /\.less$/, use: ["style-loader", "css-loader", "less-loader"] },
      { test: /\.scss$/, use: ["style-loader", "css-loader", "sass-loader"] },
      {
        test: /\.(jpg|png|gif|bmp|jpeg)$/,
        use: "url-loader?limit=987654"
      },
      {
        test: /\.(ttf|eot|svg|woff|woff2)$/,
        use: "url-loader"
      },
      {
        test: /\.js$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader: "babel-loader"
        }
      }
    ]
  }
};
package.json -> scripts
"dev": "webpack-dev-server --open --port 3000 --hot --mode development",
"build": "webpack --mode production"
创建.babelrc
内容:
{
  "presets": ["@babel/preset-env"],
  "plugins": [
    "@babel/plugin-proposal-class-properties",
    "@babel/plugin-transform-runtime"
  ]
}
平时运行指令:npm run dev
 

 

Logo

前往低代码交流专区

更多推荐