Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Error: TypeError: aStr.charAt is not a function #251

Closed
BuptStEve opened this issue Dec 28, 2018 · 3 comments
Closed

Error: TypeError: aStr.charAt is not a function #251

BuptStEve opened this issue Dec 28, 2018 · 3 comments

Comments

@BuptStEve
Copy link

BuptStEve commented Dec 28, 2018

Expected behavior

No error

Actual behavior

Emitted error but outputs seems are correct.

[ TypeError: aStr.charAt is not a function
at BasicSourceMapConsumer.SourceMapConsumer_parseMappings [as _parseMappings] (xxx/node_modules/source-map/lib/source-map-consumer.js:484:16)
at BasicSourceMapConsumer.get [as _generatedMappings] (xxx/node_modules/source-map/lib/source-map-consumer.js:70:12)
at BasicSourceMapConsumer.SourceMapConsumer_originalPositionFor [as originalPositionFor] (xxx/node_modules/source-map/lib/source-map-consumer.js:655:12)
at xxx/node_modules/merge-source-map/index.js:29:42
at Array.forEach (<anonymous>)
at BasicSourceMapConsumer.SourceMapConsumer_eachMapping [as eachMapping] (xxx/node_modules/source-map/lib/source-map-consumer.js:157:14)
at merge (xxx/node_modules/merge-source-map/index.js:24:18)
at Object.render (xxx/node_modules/@vue/component-compiler-utils/dist/styleProcessors/index.js:19:26)
at preprocess (xxx/node_modules/@vue/component-compiler-utils/dist/compileStyle.js:75:25)
at doCompileStyle (xxx/node_modules/@vue/component-compiler-utils/dist/compileStyle.js:18:48)
at Object.compileStyle (xxx/node_modules/@vue/component-compiler-utils/dist/compileStyle.js:8:12)
at SFCCompiler.compileStyle (xxx/node_modules/@vue/component-compiler/dist/compiler.js:104:51)
at input.styles.descriptor.styles.map.style (xxx/node_modules/rollup-plugin-vue/dist/index.js:104:73)
at Array.map (<anonymous>)
at Object.<anonymous> (xxx/node_modules/rollup-plugin-vue/dist/index.js:104:51)
at Generator.next (<anonymous>) ]

Steps to reproduce the behavior

Using multiple rollup configs and extract css with css: false will emit this error on the last build.

import babel from 'rollup-plugin-babel'
import postcss from 'rollup-plugin-postcss'
import replace from 'rollup-plugin-replace'
import vuePlugin from 'rollup-plugin-vue'
import { uglify } from 'rollup-plugin-uglify'
import { eslint } from 'rollup-plugin-eslint'
import nodeResolve from 'rollup-plugin-node-resolve'

import pkg from './package.json'

const name = `tua-ui`
const banner = `/* ${name} version ${pkg.version} */`

const plugins = [
    eslint({ exclude: ['**.sass', '**.scss', '**.css'] }),
    vuePlugin({ css: false }),
    postcss({
        extract: `dist/${name}.css`,
        sourceMap: true,
        extensions: ['.sass','.scss', '.css'],
    }),
    nodeResolve({ jsnext: true, main: true, browser: true }),
    babel({
        extensions: ['.js', '.jsx', '.es6', '.es', '.mjs', '.vue'],
    }),
    replace({ __VERSION__: pkg.version }),
]

export default [{
    input: 'src/index.js',
    output: [{
        file: pkg.main,
        banner,
        format: 'cjs',
        exports: 'named',
    }, {
        file: pkg.module,
        banner,
        format: 'es',
    }],
    plugins,
    external: ['vue'],
}, {
    input: 'src/index.js',
    output: {
        file: pkg.browser,
        name: 'TuaUI',
        format: 'umd',
        exports: 'named',
        globals: { vue: 'Vue' },
    },
    plugins: [ ...plugins, uglify() ],
    external: ['vue'],
}]

I guess maybe because of this. Could it be an option?

needMap: true

@rikbrowning
Copy link

I hit this issue last week, I do believe it has to do with the vue-component-compiler caching the results of source mapping and when it is called again the second time (for your second file) it gives an error. I fixed this by running my file roll ups in different processes.

@BuptStEve
Copy link
Author

I hit this issue last week, I do believe it has to do with the vue-component-compiler caching the results of source mapping and when it is called again the second time (for your second file) it gives an error. I fixed this by running my file roll ups in different processes.

needMap: false works for me...

@rikbrowning
Copy link

Can confirm that works for me, any way we can make this configurable?

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

No branches or pull requests

2 participants