ts项目搭建报错记录

ERROR in (webpack)-dev-server/client/socket.js
Module not found: Error: Can't resolve 'sockjs-client' in '/usr/local/lib/node_modules/webpack-dev-server/client'
 @ (webpack)-dev-server/client/socket.js 1:13-37
 @ (webpack)-dev-server/client?http://localhost:8888
 @ multi (webpack)-dev-server/client?http://localhost:8888 ./src/js/jwplayer.js

ERROR in (webpack)-dev-server/client/overlay.js
Module not found: Error: Can't resolve 'ansi-html' in '/usr/local/lib/node_modules/webpack-dev-server/client'
 @ (webpack)-dev-server/client/overlay.js 3:15-35
 @ (webpack)-dev-server/client?http://localhost:8888
 @ multi (webpack)-dev-server/client?http://localhost:8888 ./src/js/jwplayer.js

ERROR in (webpack)-dev-server/client/overlay.js
Module not found: Error: Can't resolve 'html-entities' in '/usr/local/lib/node_modules/webpack-dev-server/client'
 @ (webpack)-dev-server/client/overlay.js 4:15-39
 @ (webpack)-dev-server/client?http://localhost:8888
 @ multi (webpack)-dev-server/client?http://localhost:8888 ./src/js/jwplayer.js

解决方案

module.exports = {
     resolve: {
       extensions: [".ts", ".js"], // Added ".js" here
        ...
    }
};

发表新评论