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

[Q] How to extract my module #859

Closed
silverqx opened this issue Jun 6, 2017 · 2 comments
Closed

[Q] How to extract my module #859

silverqx opened this issue Jun 6, 2017 · 2 comments

Comments

@silverqx
Copy link

silverqx commented Jun 6, 2017

I'm doing custom bootstrap-sass js build, I have created this module:
resources/assets/js/external/bootstrap.js

import 'bootstrap-sass/assets/javascripts/bootstrap/transition';
// import 'bootstrap-sass/assets/javascripts/bootstrap/alert';
import 'bootstrap-sass/assets/javascripts/bootstrap/button';
// import 'bootstrap-sass/assets/javascripts/bootstrap/carousel';
import 'bootstrap-sass/assets/javascripts/bootstrap/collapse';
import 'bootstrap-sass/assets/javascripts/bootstrap/dropdown';
import 'bootstrap-sass/assets/javascripts/bootstrap/modal';
// import 'bootstrap-sass/assets/javascripts/bootstrap/tab';
// import 'bootstrap-sass/assets/javascripts/bootstrap/affix';
// import 'bootstrap-sass/assets/javascripts/bootstrap/scrollspy';
// import 'bootstrap-sass/assets/javascripts/bootstrap/tooltip';
// import 'bootstrap-sass/assets/javascripts/bootstrap/popover';

And importing it in resources/assets/js/app.js like this:

import 'jquery';
import './external/bootstrap';

// Namespaces
window.crystal = {};
window.crystal.configPhp = {};

window.axios = require('axios');

window.axios.defaults.headers.common['X-CSRF-TOKEN'] = window.Laravel.csrfToken;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

How can I extract this ./external/bootstrap module, I have tried many combinations, but only one which works, is to reference every file like this:

mix.extract([
    'bootstrap-sass/assets/javascripts/bootstrap/transition',
    'bootstrap-sass/assets/javascripts/bootstrap/button',
    'bootstrap-sass/assets/javascripts/bootstrap/collapse',
    'bootstrap-sass/assets/javascripts/bootstrap/dropdown',
    'bootstrap-sass/assets/javascripts/bootstrap/modal',
    'axios',
]);

I want to something like this:

mix.extract([
    './external/bootstrap',
// 'resources/assets/js/external/boostrap', // or this
    'axios',
]);

Can be that done by laravel mix? Or this is not supported now?

Thank you for any suggestions.

@ankurk91
Copy link
Contributor

ankurk91 commented Jun 7, 2017

Dont know if we can extract the module that was not installed through npm, if webpack can do this then mix can also do this.

@silverqx
Copy link
Author

Thank you for reply, of course that webpack can do this, it can do it by CommonsChunkPlugin, but important info is, that it's not possible with mix.extract() now ( it's of course all right ), I think this issue can be closed.

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