Search code examples
reactjswebpackbabeljspostcss

Webpack / Babel Error: Module build failed: (SystemJS) ENOENT: "object-assign"


When I'm magrate webpack from v1 to v3, I meet the ERROR:

ERROR in ./index.js Module build failed: (SystemJS) ENOENT: no such file or directory, open '/Users/zhangcong/Desktop/g/mi-insight-web/object-assign' Error: ENOENT: no such file or directory, open '/Users/zhangcong/Desktop/g/mi-insight-web/object-assign' Error loading /Users/zhangcong/Desktop/g/mi-insight-web/object-assign as "object-assign" from /Users/zhangcong/Desktop/g/mi-insight-web/node_modules/babel-loader/lib/index.js

This is the migrate guide I followed: see

I'm trying to rename modulesDirectories as modules, but failed.

Something I've done:

-root: PATH.SOURCE_PATH,
-modulesDirectories: ['node_modules'],
-extensions: ['', '.js', '.jsx'],
+modules: ['node_modules'],
+extensions: ['.js', '.jsx'],

and I migrate the postcss and removed the OccurenceOrderPlugin.

I've tried using path.resolve(), and I can't figure out why modules failed.


Solution

  • I solved by:

    npm install postcss-import@8.0.2 --save-dev
    

    see: babel-loader#242