Webpack生产构建样式没有出现 [英] Webpack production build styles do not appear

查看:30
本文介绍了Webpack生产构建样式没有出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我通过更正服务器文件解决了样式问题.我忘了更新静态资源路径.但是,我仍然有问题.我的JavaScript仍无法正确触发.

okay, i fixed the problem with my styles by correcting my server file. I had forgotten to update the static resources path. however, I am still having a problem. My javascript is still not firing correctly.

我在配置文件中为生产和开发环境定义了输出规则……但是很明显,我在此过程中犯了一个错误

i have output rules defined in my config files for both production and development environments......but clearly i made a mistake somewhere along the line

好的,在我发布此信息之前,我只想说我在努力使用webpack.作为前端开发人员,我的培训大约需要6到8个月的时间,所以我已经在新语言和新技术的缝隙中突飞猛进,而最近遍及构建工具世界的旅程可能超出了我的承受能力.

okay, before I post this I just want to say that I'm struggling pretty hard with webpack. I'm about 6 to 8 months into my training as a front end developer, so I'm already bursting at the seams with new languages and technologies, and this recent journey through the world of build tools may have been more than I can bear.

我要提出一些问题,请原谅我是否愚蠢.

I'm about to ask some questions, forgive me if they are stupid.

我正在努力理解为什么当前我的生产和开发版本表现不一样.当我运行开发版本时,我所有的样式和js都可以正常工作,但是当我运行生产版本时,我的样式或js都不起作用.dist文件夹中装有所有预期的捆绑文件(我所有的缩小的css和js都在其中),并且所生成的index.html中的所有路径似乎都指向dist文件夹中的正确位置.....我在下面发布了指向github仓库的链接.

I'm struggling to understand why, currently, my production and development builds are not behaving the same. when i run my dev build, all my styles and js work correctly, however when i run my production build, none of my styles or js work. The dist folder is populated with all the expected bundled files (all my minified css and js is there) and all of the paths in the index.html that is generated seem to point to the correct places in the dist folder.....I'm posting a link to the github repo below.

寻找任何提示或线索.请随时询问更多信息,我真的不知道从哪里开始寻找该原因(我还没有检查过).我认为我在网络上在线学习的有关Webpack的课程材料非常差……

Looking for any tips or clues. please feel free to ask for more info, I don't really have the first idea of where to start looking (that I haven't already checked) for the cause. the course material i'm consuming online about webpack was pretty poor in my opinion......

https://github.com/Funkh0user/nlp-project

推荐答案

好的.我确切地确定了我的问题所在.

alright. I determined exactly what my problems were.

  1. 如该线程前面所述,我需要更新服务器以反射位于/dist文件夹中的静态资源.

  1. as noted earlier in the thread, I needed to update my server to reflex my static resources being located in the /dist folder.

js问题原来是我在加载程序规则的正则表达式中使用了qoutes.

the js problem turned out to be that I had used qoutes in the regex in the loader rules.

已解决.谢谢大家的帮助.

Solved. Thanks for the help everyone.

这篇关于Webpack生产构建样式没有出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆