为什么要解决'指导剂量在webpack.cofig.js中不起作用

发布于 2025-01-27 18:41:50 字数 1011 浏览 1 评论 0原文

无法理解,为什么该程序一直在寻找.src?在尝试测试webpack.config.js文件上的解析方法时。正如我所理解的,在“ npm run构建”后,“ resolve'''''''''''''''''''''''''''''''''''''''''''''''''''''和file''和File通过遵循预装。请帮助泳池新手。谢谢。

const path = require('path')

// export

module.export ={
  entry:'./js/main.js',
  output:{
    path: path.resolve(__dirname, "public"),
    filename:'main.js'
  }
}

和错误如下

ERROR in main
Module not found: Error: Can't resolve './src' in '/Users/MU/Desktop/webpack-template-basic'
resolve './src' in '/Users/MU/Desktop/webpack-template-basic'
  using description file: /Users/MU/Desktop/webpack-template-basic/package.json (relative path: .)
    Field 'browser' doesn't contain a valid alias configuration
    using description file: /Users/MU/Desktop/webpack-template-basic/package.json (relative path: ./src)
      no extension

![错误]: https://i.sstatic.net/rffo4.png < /a>

Cannot understand, why the program keep looking for .src? while trying to test resolve method on the webpack.config.js file. As I understood, after 'npm run build' the 'resolve' make a new folder and file by following the pre-setting. please help pool Novice. thank you.

const path = require('path')

// export

module.export ={
  entry:'./js/main.js',
  output:{
    path: path.resolve(__dirname, "public"),
    filename:'main.js'
  }
}

and error showed as below

ERROR in main
Module not found: Error: Can't resolve './src' in '/Users/MU/Desktop/webpack-template-basic'
resolve './src' in '/Users/MU/Desktop/webpack-template-basic'
  using description file: /Users/MU/Desktop/webpack-template-basic/package.json (relative path: .)
    Field 'browser' doesn't contain a valid alias configuration
    using description file: /Users/MU/Desktop/webpack-template-basic/package.json (relative path: ./src)
      no extension

![error]: https://i.sstatic.net/RfFo4.png

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蒲公英的约定 2025-02-03 18:41:50

花了几个小时来搜索解决问题后,我刚刚在项目文件夹中创建了“ SRC”文件夹。这是有效的,但仍然存在持续的问题。有人与我相同的问题,只是创建文件夹,就像您在错误上所看到的那样。它不是针对原始解决方案的临时解决方案。祝您开始像我一样开始编码。谢谢。

  • 我在CLI'NPM Run Dev中输入的愚蠢错误,而不是“ NPM Run Build”。运行生产时创建的文件夹和文件。不打开Dev-Server。

After spending couple of hours to search for solving the problem, I just created 'src' folder in the project folder. it was works but still has ongoing problem. Someone has same problem as me just creating folder as you see on the error. It is temporary solve not for the original solution. best wish you who start coding like me. Thanks.

  • and had stupid mistake that i typed in cli 'npm run dev' instead of 'npm run build'. the folder and file created when run the production. not open dev-server.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文