を解決できません:エラーWebPACKの2モジュールが見つかりません:私は私のbundle.jsを作成したい場合はモジュール
$ ./node_modules/.bin/webpack --config webpack.config.js
私はプロジェクトツリーには、次のされ
ERROR in ./dev/js/source/scripts/components/TextInput.js Module not found: Error: Cannot resolve module 'source/scripts/components/IconButton' in /Users/sebastien/Documents/Javascript/Tests/MyApp/dev/js/source/scripts/components @ ./dev/js/source/scripts/components/TextInput.js 4:18-65
ERROR in ./dev/js/source/scripts/components/TextInput.js Module not found: Error: Cannot resolve module 'source/scripts/SDK/classNames' in /Users/sebastien/Documents/Javascript/Tests/MyApp/dev/js/source/scripts/components @ ./dev/js/source/scripts/components/TextInput.js 15:17-57
次のエラーを取得しますTextInput.jsで
/Users/sebastien/Documents/Javascript/Tests/MyApp
- webpack.config.js
- dev
- js
- index.js
- source
- scripts
- components
- TextInput.js
- IconButton.js
- SDK
- classNames.js
次の文
0がありますimport IconButton from "source/scripts/components/IconButton";
と私のwebpack.config.js次
var path = require('path');
var webpack = require('webpack');
module.exports = {
devServer: {
inline: true,
contentBase: './src',
port: 8080
},
devtool: 'cheap-module-eval-source-map',
entry: './dev/js/index.js',
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel'],
exclude: /node_modules/
},
{
test: /\.scss/,
loader: 'style-loader!css-loader!sass-loader'
}
]
},
output: {
path: 'src',
filename: 'js/bundle.min.js'
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin()
]
};
がどのようにパスを追加するWebPACKのを設定することができます含まれているモジュールを検索する./dev/js?私は試しました:
- modules: [path.resolve(__dirname, "./dev/js"), "node_modules"]
成功なし。手伝ってくれますか?
よろしく、
ありがとうございますが、私はディレクトリスクリプトの下にある.jsファイルのソースコードを変更したくありません。 私はこれらの* .jsファイルの所有者ではありません(別のチームが提供しています)。私はwebpackの設定で問題を解決したいと思います(もし可能ならば?)。 – sebastien
ええ、ごめんなさい、お手伝いできません。私は、Reactで働いている間に全く同じ問題があったので、私が提供した答えがうまくいくかもしれないと思った。私は実際にwebpackを使ったことは一度もありませんでしたが、Googleのエラーを検索した場合、「webpackモジュールが設定されたパスを見つけられない」などのようなものか、単に適切な回答を待っています。 –
ごめんなさい。誰かが答えて助けようとすると、いつも感謝しています。 – sebastien