Answer the question
In order to leave comments, you need to log in
How to write json correctly?
Hello!
I'm learning webpack and I want to connect the node-static plugin so that it passes parameters to headers. I follow the instructions as here: (at the very end) https://github.com/cloudhead/node-static
This is how I write it in my package.json
{
"name": "webpack-app",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "webpack --mode production --watch",
"dev": "webpack --mode development",
"serv": "static -H '{"Cache-Control": "no-cache, must-revalidate"}'" // Данная строка
},
"devDependencies": {
"html-webpack-plugin": "^3.2.0",
"node-static": "^0.7.11",
"webpack": "^4.39.2",
"webpack-cli": "^3.3.6"
}
}
"serv": "static -H '{\"Cache-Control\": \"no-cache, must-revalidate\"}'"
undefined:1
'{Cache-Control:
^
SyntaxError: Unexpected token ' in JSON at position 0
........
undefined:1
{Cache-Control: no-cache,
^
SyntaxError: Unexpected token C in JSON at position 1
Answer the question
In order to leave comments, you need to log in
{
"name": "webpack-app",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "webpack --mode production --watch",
"dev": "webpack --mode development",
"serv": "static -H \"{\"Cache-Control\": \"no-cache, must-revalidate\ "}\""
},
"devDependencies": {
"html-webpack-plugin": "^3.2.0",
"node-static": "^0.7.11",
"webpack": "^4.39.2" ,
"webpack-cli": "^3.3.6"
}
}
in the future I recommend using an editor like this
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question