Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Vendor JS Issue #138

Closed
goxmedia opened this issue Apr 12, 2020 · 8 comments
Closed

Build Vendor JS Issue #138

goxmedia opened this issue Apr 12, 2020 · 8 comments

Comments

@goxmedia
Copy link

goxmedia commented Apr 12, 2020

When importing Bootstrap into the build-js-vendor.js task via vendors-compile.js, the task fails due to THIS_IS_UNDEFINED error code.

We fixed this by adding the following to the onwarn block:

    onwarn(warning, warn) {
      if (warning.code === 'THIS_IS_UNDEFINED') { return; }
      throw new Error(warning.message);
    },

Here is our import via vendors-compile.js:

import "bootstrap"
@sgurin
Copy link
Contributor

sgurin commented Apr 12, 2020

Hi @goxmedia

Thanks for the feedback.

According to the Bootstrap Doc https://getbootstrap.com/docs/4.4/getting-started/download/ "The bootstrap module itself does not export anything. " So, I would recommend importing Bootstrap modules via vendor.js file and specify the path to modules that you are going to us or import already compiled bundle "'./node_modules/bootstrap/dist/js/bootstrap.js'"

As for the error, we will check it. From my point of view, require should works but smth went wrong :)

Thanks a lot

@goxmedia
Copy link
Author

Hi @sgurin

Thanks for the reply. The issue we have when importing Bootstrap via the vendor.js file, vendor-compile.js does not "process" that import, i.e., babel() or terser(). We want to create a custom build of Bootstrap with only those components we intend to use and not the entire Boostrap library.

Thanks in advance for your help.

@sgurin
Copy link
Contributor

sgurin commented Apr 14, 2020

Hi @goxmedia

You can import only modules that your are going to use. For example, if collapse is needed then util and collapse should be imported https://prnt.sc/ryw0nw

All modules are separated into files and you can use already compiled files from dist folder or unminified from src folder https://prnt.sc/ryw1lj

@goxmedia
Copy link
Author

Hi @sgurin

Thanks again for your reply. I understand. So what types of vendor js files would go into vendor-compile.js?

@sgurin
Copy link
Contributor

sgurin commented Apr 16, 2020

Hi @goxmedia

You can use any types of modules in the vendor-compile.js but do not forget to connect them inside your code correctly :)

@goxmedia
Copy link
Author

Hi @sgurin

Thanks for your help. Really appreciate you guys making this code available to the community.

@sgurin
Copy link
Contributor

sgurin commented Apr 22, 2020

Hi @goxmedia

WSK version is updated and now ES6 imports could be used but I still would recommend using small chunks of plugins in case of the bootstrap.

#140
https://github.com/justcoded/web-starter-kit/releases/tag/v4.0.1

@sgurin sgurin closed this as completed Apr 22, 2020
@goxmedia
Copy link
Author

@sgurin

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants