Today, after writing the code, there was a sudden problem with packaging
browser error: Uncaught ReferenceError: exports is not defined
Compiler error:
warning in. / src/main.js
"export "default" (imported as" filters") was not found in". / filters"
I modified the code for a day today. I remember that I didn"t change the operation of filters, and main.js didn"t move. I was debugging while I was running. After packing, I suddenly didn"t report an error. I checked the path, file path and word spelling several times.
the file directory is as follows:
filters/index.js Code
exports.statusName = (value, type) => {
if (type === 0 && value === 0) {
return ""
}
if (type === 0 && value === 1) {
return ""
}
if (type === 1 && value === 0) {
return ""
}
if (type === 1 && value === 1) {
return ""
}
if (type === 2 && value === 0) {
return ""
}
if (type === 2 && value === 1) {
return ""
}
}
main.js Code
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import iView from "iview";
import filters from "./filters";
import "iview/dist/styles/iview.css";
import "@/my-theme/index.less";
import "@/assets/css/iconfont.css";
import "@/assets/css/common.less";
Vue.config.productionTip = false;
Vue.use(iView);
Object.keys(filters).forEach(k => Vue.filter(k, filters[k]));
new Vue({
router,
store,
render: h => h(App)
}).$mount("-sharpapp");
the mentality of finding is broken, and I would like to ask all of you to give us some advice on why you suddenly made a mistake. Thank you very much
.