0
私は、このファイルを使用してサブディレクトリsubdir
を持っている:サブディレクトリにあるプロジェクトでwepbackを実行するには?
// subdir/local.js
document.body.textContent = 'hello from subdir/local.js'
とwebpack.config.js
ローカル:
// subdir/webpack.config.js const { createConfig, entryPoint, setOutput } = require('@webpack-blocks/webpack') const devServer = require('@webpack-blocks/dev-server') module.exports = createConfig([ entryPoint('.'), setOutput('./bundle.js'), devServer(), ])
ルートディレクトリに同じ設定の作品。
ERROR in multi main Module not found: Error: Cannot resolve 'file' or 'directory' . in /Users/dmitrizaitsev/Dropbox/Sandbox/webpack-blocks-test/subdir @ multi main
がどのように私はそのエラーを修正することができ、サブディレクトリ内のプロジェクトとのWebPACKを実行します。ただし、ローカルで実行
のWebPACKはエラーに
リードをlocal.js?
「webpack.config.js」( 'index.js'と' local.js')で設定された 'entry'でローカルでしか動作しますが、CLIからファイルが渡されたときは動作しません。理想的には、私はルート内の1つの設定ファイルだけを好むでしょう。それは、それをどのサブディレクトリでも使用できるようにします。 –
[context](https://webpack.js.org/configuration/entry-context/#context)プロパティを設定/変更することでこれを行うことができます –