sourcesContent const 旧版本浏览器不支持
Opened this issue · 2 comments
wangh1998 commented
tabooc commented
修改打包配置
rollup.config.js
import vue from "rollup-plugin-vue";
import autoprefixer from "autoprefixer";
import precss from "precss";
import babel from "@rollup/plugin-babel";
export default [
{
input: "./src/index.vue",
output: {
format: "esm",
file: "dist/picker.esm.js",
sourceMap: false
},
plugins: [
vue({
style: {
postcssPlugins: [precss(), autoprefixer()]
},
needMap: false
}),
babel({
exclude: "node_modules/**",
extensions: [".js", ".ts", ".tsx", ".vue"],
babelHelpers: "bundled"
})
]
}
];
根目录增加 babel.config.json
{
"presets": ["@babel/preset-env"]
}
运行
1 npm run rollup
2 npm run build
得到新的vue-picker.js
wangh1998 commented
尝试可用。
目前自己的解决办法是将vue-picker.js,图示部分const变为var。