Skip to content

Support ES6 import from <script type="module"> tag inside browser #1247

Closed
@gorbypark

Description

@gorbypark

What problem does this feature solve?

Using vuex in the browser is possible, by using a standard html <script src='"vuex.js"> tag, but if you want to use something like mapGetters, it require something like import { mapGetters } from 'vuex'. This is in theory possible in the browser by using a tag like

<script type="module>
  import { mapGetters } from './vuex.js'
  ...
</script>

but appears to not work with vuex. Vue itself, using the vue.esm.browser.js bundle from unpkg works this way, but if vuex.esm.js is used it produces an error.

ReferenceError: process is not defined
    at Vue.mappedGetter (vuex.esm.js:848)
    at Watcher.get (vue.js:3140)
    at Watcher.evaluate (vue.js:3247)
    at Proxy.computedGetter (vue.js:3503)
    at Proxy.eval (eval at createFunction (vue.js:10667), <anonymous>:3:144)
    at Vue._render (vue.js:4535)
    at Vue.updateComponent (vue.js:2788)
    at Watcher.get (vue.js:3140)
    at new Watcher (vue.js:3129)
    at mountComponent (vue.js:2795)

What does the proposed API look like?

import { ... } from 'vuex.esm.js' should work inside the browser.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions