webpack只打包打包src下的index.js文件出错

webpack只打包src下的index.js文件,出现:

ERROR in ./src/index.js 1:0
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)

原因:

用以下命令创建的index.js文件, webpack打包会出错 :

echo null >> ./src/index.js

解决方法:

右键新建index.js文件即可

你可能感兴趣的:(javascript)