Closed keepresolve closed 6 years ago
The problem come from your import
reaches vue-introjs/src/index.js
file which is es6-formatted. So you have many solutions :
import VueIntro from 'vue-introjs/dist/index.min';
babel-loader
in your Webpack config:module: {
rules: [{
test: /\.js$/,
include: [path.resolve(__dirname, 'node_modules/vue-introjs')],
loader: 'babel-loader'
}]
}
resolve: {
alias: {
'vue-introjs': 'vue-introjs/dist/index.min.js'
}
}
You forgot to add Vue.use(VueIntro)
import VueIntro from 'vue-introjs';
Vue.use(VueIntro);
That's in test/unit/setup.js and then I get the import error as mentioned in https://forums.manning.com/posts/list/0/43203.page#p121739
I am not sure if your error relates to this package. AFAIK, it is about wrong webpack\jest\babel setup. Probably, it ignores files from ./node_modules directory (when runs transpiling es6 -> es5)
https://github.com/facebook/jest/issues/3202 https://stackoverflow.com/questions/42226674/babel-jest-doesnt-handle-es6-within-modules
as mentioned inthe latter:
By default any code in node_modules is ignored by babel-jest, see the Jest config option transformIgnorePatterns.
https://facebook.github.io/jest/docs/en/configuration.html#testpathignorepatterns-array-string
@ghenry, @keepresolve i've published a new release which users ES5 version by default. please, test if this fixes the issue
Upgraded. I now get, with no changes:
ReferenceError: introJs is not defined
ReferenceError: introJs is not defined
at VueComponent.t.$intro (/home/ghenry/src/SureVoIP-Portal/root/src/client_side/node_modules/vue-introjs/dist/index.min.js:1:9162)
at VueComponent.mounted (/home/ghenry/src/SureVoIP-Portal/root/src/client_side/src/components/Dashboard.vue:113:10)
at callHook (/home/ghenry/src/SureVoIP-Portal/root/src/client_side/node_modules/vue/dist/vue.runtime.common.js:2919:21)
@ghenry , introJs is an external depency. Include it in your build before injecting the plugin. Refer docs.
introJs is an external depency. Include it in your build before injecting the plugin. Refer doc
@alex-oleshkevich
When I run my jest unit tests, I too am getting the error ReferenceError: introJs is not defined
. How, do I inject IntroJS as a plugin in unit tests.
vue-cli import VueIntro from 'vue-introJs'; Vue.use(VueIntro); // error Uncaught SyntaxError: Unexpected token ( autostart.js?9e2a:29