-
-
Notifications
You must be signed in to change notification settings - Fork 148
normalizeComponent function dose not get transpiled #262
Comments
Files in Anyways, I'd publish an es2015 version of |
add code |
{
plugins: [
vue({
normalizer: '~vue-runtime-helpers/dist/normalize-component.js'
})
]
} |
@znck Hi, the problem is still there, and at 2019 you promised a "es2015 version of vue-runtime-helpers soon", how is it going? |
ES2015 version is already there. See .mjs files in https://unpkg.com/browse/[email protected]/dist/ You can use ES2015 version using the API as suggested by @lc-soft in the above example. |
@znck Hi, I am using rollup and |
@znck There is still the problem of no conversion, these codes are not translated /* style */
const __vue_inject_styles__ = undefined;
/* scoped */
const __vue_scope_id__ = undefined;
/* module identifier */
const __vue_module_identifier__ = undefined;
/* functional template */
const __vue_is_functional_template__ = false;
/* style inject */ This is my configuration /** @format */
/* eslint-disable @typescript-eslint/no-var-requires */
const rollup = require('rollup')
const vue = require('rollup-plugin-vue')
const babel = require('rollup-plugin-babel')
const commonjs = require('rollup-plugin-commonjs')
const resolve = require('rollup-plugin-node-resolve')
const typescript = require('rollup-plugin-typescript')
const terser = require('rollup-plugin-terser').terser
const components = require('../components.json')
function kebabToCamel(str) {
return str.replace(/(^\w)|(-(\w){1})/g, ($1, _, __, $4) => ($4 || $1).toLocaleUpperCase())
}
function gerenateNameScope(name) {
return 'Yys' + kebabToCamel(name)
}
const buildPlugins = [
vue({
normalizer: '~vue-runtime-helpers/dist/normalize-component.js',
}),
typescript(),
resolve({
browser: true,
}),
babel({
babelrc: true,
exclude: 'node_modules/**',
}),
commonjs(),
terser(),
]
async function build(inputOptions, outputOptions) {
const bundle = await rollup.rollup(inputOptions)
await bundle.write(outputOptions)
}
const componentNames = Object.keys(components)
componentNames.forEach(name => {
const inputOptions = {
input: components[name],
external: ['vue', 'vue-class-component', 'vue-property-decorator'],
plugins: buildPlugins.slice(0, 5),
}
const outputOptions = {
globals: {
vue: 'vue',
'vue-class-component': 'vue-class-component',
'vue-property-decorator': 'vue-property-decorator',
},
name: gerenateNameScope(name),
file: `dist/${name}.js`,
format: 'umd',
}
const minInputOptions = {...inputOptions, plugins: buildPlugins}
const minOutputOptions = {
...outputOptions,
file: `dist/${name}.min.js`,
}
build(inputOptions, outputOptions)
build(minInputOptions, minOutputOptions)
}) |
Version
4.6.1
Reproduction link
https://codesandbox.io/s/9483vj1jw
Steps to reproduce
Example rollup config file:
What is expected?
The
normalizeComponent
function fromvue-runtime-helpers
is injected by this plugin, it should be transpiled.What is actually happening?
The following generated code still contains
const
keywords after usingrollup-plugin-vue
androllup-plugin-babel
.The text was updated successfully, but these errors were encountered: