LoginSignup
0
2

More than 5 years have passed since last update.

WebpackでXMLHttpRequestを扱う

Posted at

xmlhttprequestを利用していると、Webpackのビルド中にエラーが起きる。

ERROR in ./node_modules/xmlhttprequest/lib/XMLHttpRequest.js
Module not found: Error: Can't resolve 'child_process' in '/path/to/node_modules/xmlhttprequest/lib'

検索してみるとWebpackのIssueで同じ問題を投げている人がいた。 Cannot resolve module 'child_process' to build XMLHttpRequest #66

そこで書かれている解決策はwebpack.config.jsに次の設定を入れるというもの。

externals:[{
    xmlhttprequest: '{XMLHttpRequest:XMLHttpRequest}'
}]
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2