Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sourcesContent const 旧版本浏览器不支持 #68

Open
wangh1998 opened this issue Apr 25, 2021 · 2 comments
Open

sourcesContent const 旧版本浏览器不支持 #68

wangh1998 opened this issue Apr 25, 2021 · 2 comments

Comments

@wangh1998
Copy link

image

@tabooc
Copy link

tabooc commented Sep 30, 2021

修改打包配置
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
Copy link
Author

尝试可用。
目前自己的解决办法是将vue-picker.js,图示部分const变为var。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants