I referenced the components of element and wanted to transform it into my own UI library. After packaging, I introduced the project, npm run dev and reported the following error:
introduced package: node_modules/ipst/dist/ipst.js error:
Uncaught TypeError: Cannot read property "NODE_ENV" of undefined
at Object.eval (ipst.js?df1b:formatted:346)
at t (ipst.js?df1b:formatted:15)
at Object.eval (ipst.js?df1b:formatted:28432)
at t (ipst.js?df1b:formatted:15)
at Object.eval (ipst.js?df1b:formatted:8917)
at t (ipst.js?df1b:formatted:15)
at Object.eval (ipst.js?df1b:formatted:28432)
at t (ipst.js?df1b:formatted:15)
at Object.eval (ipst.js?df1b:formatted:28432)
at t (ipst.js?df1b:formatted:15)
directory structure:
webpack.base.conf.js
webpack.prod.conf.js
:
example/main.js, reference
import Vue from "vue";
import App from "./App";
import router from "./router";
// dev
// import "ele/theme-chalk/src/index.scss";
// import Ipst from "@/index.js";
// dist
import "../dist/static/ipst.css";
import Ipst from "../dist/ipst.js";
Vue.config.productionTip = false;
Vue.use(Ipst);
/* eslint-disable no-new */
new Vue({
el: "-sharpapp",
router,
components: { App },
template: "<App/>"
});