16
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

posted at

Webpack 4を使ってみたらビルド時に[WARNING]が出たので

とりあえず最新構成を使用してVue × TypeScriptの開発をしようしたらWARNINGが出たのでメモを残しておきます。

環境

モジュール名 バージョン
mpm 5.7.1
Webpack 4.1.1

エラー内容

WARNING in configuration
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.

原因

pagckage.jsonに本番または開発の構成を追加しないといけないらしい。

解決方法

pagckage.jsonに以下の構成を追加

"scripts": {
  "dev": "webpack --mode development",
  "build": "webpack --mode production"
}

使い方

# 開発時
npm run dev

# 本番時
npm run build

参考

公式チュートリアル

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
16
Help us understand the problem. What are the problem?