State Valentin Posted September 21, 2018 Share Posted September 21, 2018 Ok so my index.js from server-side looks like this: // Loading official packages of the server const glob = require('glob'); const config = require('./config.js'); glob ('./packages/semp/Assets/**/*.js', function(err,files) { for (file of files) { require(file.replace('./packages/semp/','./')); if(config.env == 'dev') { console.log(file); } } }); I want to do the same to the client-side packages. But how can i do that if i can't load an npm package with Vanilla JS ? Any fix to that ? Link to comment Share on other sites More sharing options...
micaww Posted September 23, 2018 Share Posted September 23, 2018 Wrong area to post this, but the client-side JS supports the require function to load in other files. For using packages from NPM you just have to include them in your client_packages directory so they get sent to each client. I suggest something like Webpack to handle bundling for you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now