在构建我的生产项目时,我遇到了 webpack 问题。显然这是查询字符串和 Uglify 之间的一些交互问题。嗨,已经搜索堆栈溢出一段时间了,并尝试了很多东西,但找不到解决方案或问题的原因。
也许有人有我可以尝试的提示或解决方案,因为目前我被卡住了。
为生产构建时出现的错误如下:
......
ERROR in index.bundle.js from UglifyJs
Invalid assignment [./node_modules/query-string/index.js:8,0][index.bundle.js:62484,30]
ERROR in index.bundle.js from UglifyJs
Invalid assignment [./node_modules/query-string/index.js:8,0][index.bundle.js:62484,30]
.......
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @coreui/react@1.0.10 build: `webpack -p --progress --env.prod`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @coreui/react@1.0.10 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this …Run Code Online (Sandbox Code Playgroud)我有以下视图代码:
def control_activation(request, device_id, variable_name, activated):
time_now = int(datetime.utcnow().strftime('%s'))
variable_qs = Variables.objects.filter(device_id=device_id, name=variable_name)
variable = variable_qs[0]
variable.activation = activated
variable.updated_at = time_now
variable.save()
coco_qs = GlobalUpdateTable.objects.all()
coco = coco_qs[0]
coco.variable_udated = time_now
coco.save
return HttpResponse()
Run Code Online (Sandbox Code Playgroud)
出于某种原因,我无法理解第一个save(variable.save)是做了什么,但第二个(coco.save)没有.
如果我使用以下代码,在第二部分而不是上面的代码,我可以将值保存到数据库:
GlobalUpdateTable.objects.all().update(variable_updated=time_now)
Run Code Online (Sandbox Code Playgroud)
两个代码都应该能够更新列(variable_updated).表GlobalUpdateTable只有一行,可以用任何方式构成问题吗?
作为参考,我指出了模型:
class Variables(models.Model):
name = models.CharField(max_length=20)
device_id = models.ForeignKey(Devices, to_field='id')
device_addr = models.CharField(max_length=6)
device_type = models.CharField(max_length=20)
response_tag = models.CharField(max_length=10)
command = models.CharField(max_length=6)
config_parameter = models.CharField(max_length=6)
unit = models.CharField(max_length=4)
direction = models.CharField(max_length=6)
period = models.IntegerField(null=True, blank=True, …Run Code Online (Sandbox Code Playgroud)