jsonGPPD
jsonGPPD

Reputation: 1037

Import and use 3rd Party Package with Webpack and Vue.JS

Good day,

I'm currently new in integration vue.js in webpack.

Basically, I'm trying to use a 3rd party package that I've already installed inside in my node_modules.

In this example, I installed a package called "Vuex Toast" (an alert for vue.js). NPM Package here

Here's my project structure.

.../js/main.build.js
.../src-modules/app.js (blank for now)

Normally, everytime I run webpack command, I generate my main.build.js

Can someone help me how to use that 3rd party package here?

Upvotes: 1

Views: 608

Answers (1)

timetowonder
timetowonder

Reputation: 5411

The idea of webpack (and bundlers in general) is that you require code and webpack bundles it for you.

In your app.js do the following:

const vuexToast = require('vuex-toast');

Now you can use it. Webpack will know to check your node_modules/vuex-toast folder.

Upvotes: 1

Related Questions