lifesound's avatar

How to import node modules and how to decouple prod files

Using Laravel mix .. How to import - for example - buefy in the public/app.js file ?

the buefy located in the node_modules/buefy .

how to import the js file for app.js ??

From where i reference the node_modules ?? what is the entry point ,so?

In the vuecasts series , in the public directory , Jeff has created components/notification.vue component ..

when he imported it he import notification from './components/notification'??

why Jef added the './' up-directory although the app.js and the components dir are in under the same directory which is 'js'?

Another question for the css , how to import all the scss of buefy/bulma ??

Lastly , How to create decoupled app.js files ( like app_main_page.js & app_post.js && app_category.js) in which every one will contain special and only required components for that page .. to minimize the produced js file generated ??

0 likes
3 replies
Rachid804's avatar
Level 2
  1. How to import the in app.js ?

You have the answer in the repository here this is different from the components you create yourself

import Buefy from 'buefy';

Vue.use(Buefy);

Refer to this simple app for more details

  1. ./ refer to the current directory and ../ refer to the parent directory

  2. For the css, import 'buefy/lib/buefy.css'; But if you want to customize the colors for example you car always use sass in your app.scss @import "~bulma/sass/utilities/_all"; More details here

  3. How to create decoupled app.js files ? That's what components and routes are for, learn more about them and you will be able to achieve what you have in mind , think about it like this, app.js is the entry point, the parts of your application are components that are referenced in app.js

Please or to participate in this conversation.