zoukankan      html  css  js  c++  java
  • 使用vue.js常见错误之一

    打包项目时,在vscode中输入如下命令

    webpack .srcmain.js .distundle.js

    出现如下错误:

    WARNING in configuration
    The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
    You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/

    ERROR in multi ./src/main.js ./dist/bundle.js
    Module not found: Error: Can't resolve '.distundle.js' in 'E:Vue相关练习webpack-study'
    @ multi ./src/main.js ./dist/bundle.js main[1]

    因为这是老版本,而在webpack4之后 官方对 webpack-cli 单独抽离了出来 所以我们需要做如下步骤方可成功

    1. 安装webpack

    npm i webpack -g
    2. 安装 cli

    npm i -g webpack-cli
    3. 打包 将 main.js bundle.js 替换了就可以

    npx webpack main.js --output-filename bundle.js  --output-path . --mode development

  • 相关阅读:
    git忽略已提交过的文件方法
    去除git版本控制
    写博客的初衷
    Substring with Concatenation of All Words
    Course Schedule
    Reverse Words in a String--not finished yet
    Repeated DNA Sequences
    Maximum Product of Word
    Odd Even Linked List
    Reorder List
  • 原文地址:https://www.cnblogs.com/zylstu/p/10544813.html
Copyright © 2011-2022 走看看