Please help ... Invalid left-hand side in assignment
marvix opened this issue · 9 comments
Please Help
Anyone met such error?
Invalid left-hand side in assignment
The chrome source tab showing this location for the error
var createContext = (ctx) => {
ctx = Object.assign({
cwd: process.cwd(),
env: "development"
}, ctx);
if (!ctx.env) {
"development" = "development"; // <--- this the error
}
return ctx;
};
The source of this code is node_module/postcss-load-config/index.js
/**
* Builds the Config Context
*
* @param {Object} ctx Config Context
*
* @return {Object} Config Context
*/
const createContext = (ctx) => {
/**
* @type {Object}
*
* @prop {String} cwd=process.cwd() Config search start location
* @prop {String} env=process.env.NODE_ENV Config Enviroment, will be set to `development` by `postcss-load-config` if `process.env.NODE_ENV` is `undefined`
*/
ctx = Object.assign({
cwd: process.cwd(),
env: process.env.NODE_ENV
}, ctx)
if (!ctx.env) {
process.env.NODE_ENV = 'development'
}
return ctx
}```
How to fix it, am I doing something bad?
Please use stackoverflow for this questions, thanks, you can't assign "development" = "development"
in JS (i.e. assign string to string, it is not variable)
Please use stackoverflow for this questions, thanks, you can't assign
"development" = "development"
in JS (i.e. assign string to string, it is not variable)
I could not find an answer anywhere. the error is coming from postcss loader, I didn't write the code!
Do you try bundle postcss-loader
?
Sorry, I'm new to Node & JS world ... I don't believe that postcss-loader
is bundled, here is the package.json
"name": "front-template",
"version": "0.0.3",
"scripts": {
"dev": "vite --host",
"build_watch": "vite build --watch",
"build": "vite build",
"serve": "vite preview"
},
"dependencies": {
"@headlessui/vue": "^1.4.2",
"@heroicons/vue": "^1.0.5",
"@vuelidate/core": "^2.0.0-alpha.32",
"@vuelidate/validators": "^2.0.0-alpha.25",
"axios": "^0.24.0",
"vue": "^3.2.29",
"vue-router": "^4.0.12",
"vuex": "^4.0.2"
},
"devDependencies": {
"@tailwindcss/forms": "^0.3.4",
"@vitejs/plugin-vue": "^2.1.0",
"@vue/compiler-sfc": "^3.2.29",
"autoprefixer": "^10.4.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-vue": "^7.20.0",
"path": "^0.12.7",
"postcss": "^8.4.6",
"prettier": "^2.5.1",
"tailwindcss": "^2.2.19",
"vite": "^2.7.13"
}
}
You use vite, so I think you are in wrong repo
But the error is with postcss-loader
Sorry, I can't help here, you use vite, you don't need postcss-loader
Well, thank you. But would please tell me if Vite is bundling it?
I don't know, better ask vite developers about it, vite should not use postcss-loader