vuejs / vue-loader

📦 Webpack loader for Vue.js components
MIT License
4.99k stars 915 forks source link

const/let converto var #2070

Open zacard-orc opened 7 months ago

zacard-orc commented 7 months ago

hi , i want to use webpack in chrome <40, but can't run normally when use default config in babel/vue-loader

i try to use these terms, but not work

 {
            test: /\.vue$/,
            loader: 'vue-loader',
            options: {
                transformAssetUrls: {
                    video: ['src', 'poster'],
                    source: 'src',
                    img: 'src',
                    image: 'xlink:href'
                },
                babelPresets: ['@babel/preset-env'],
                babelPlugins: ['@babel/plugin-transform-block-scoping']
            }          
        }

the phrase 1 converted js also has const/let keyword, eg:

import { render } from "./TabList.vue?vue&type=template&id=71e458cc"
import script from "./TabList.vue?vue&type=script&lang=js"
export * from "./TabList.vue?vue&type=script&lang=js"

import "./TabList.vue?vue&type=style&index=0&id=71e458cc&lang=scss"

import exportComponent from "/Users/macbookpro/Documents/mylab/vue3_wp5/node_modules/vue-loader/dist/exportHelper.js"
const __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])

export default __exports__
const __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])

these middleware file will save into webpack dist file,just like

        const u = (0, i.Z)(o, [["render", function (n, t, o, i, u, c) {
            return (0, e.openBlock)(), (0, e.createElementBlock)("div", l, [r, (0, e.createElementVNode)("div", {
                class: "tab-area",
                ref: "rfTab",
                onScroll: t[1] || (t[1] = function () {
                    return n.onScroll && n.onScroll.apply(n, arguments)
                })
            }, 

so , it can't nor run in chrome<43, chrome will throw error about const/let

how can i config the file to transform "const exports = /#PURE/exportComponent(script, [['render',render]])" to "var exports = /#PURE/exportComponent(script, [['render',render]])"

thanks

NeverCD commented 4 months ago

same problem, any solution?