Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
es2015: replace 'require' with 'import' syntax
Browse files Browse the repository at this point in the history
Signed-off-by: Vítor Avelino <contact@vitoravelino.me>
  • Loading branch information
vitoravelino committed Apr 6, 2017
1 parent 302a93f commit efbff08
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
38 changes: 18 additions & 20 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
// jQuery
window.jQuery = require('jquery');
require('jquery-ujs');
import 'jquery';
import 'jquery-ujs';

// Bootstrap
require('bootstrap/js/transition');
require('bootstrap/js/tab');
require('bootstrap/js/tooltip');
require('bootstrap/js/popover');
import 'bootstrap/js/transition';
import 'bootstrap/js/tab';
import 'bootstrap/js/tooltip';
import 'bootstrap/js/popover';

// Life it up
require('vendor/lifeitup_layout');
import 'vendor/lifeitup_layout';

// NOTE: should be removed in the future
require('vendor/bootstrap-typeahead');
import 'vendor/bootstrap-typeahead';

// Require tree.
// NOTE: This should be moved into proper modules.
require('./alert');
require('./bootstrap');
require('./dashboard');
require('./includes/open_close_icon');
require('./includes/set_typehead');
require('./namespaces');
require('./open_search');
require('./repositories');
require('./teams');
import './alert';
import './bootstrap';
import './dashboard';
import './includes/open_close_icon';
import './includes/set_typehead';
import './namespaces';
import './open_search';
import './repositories';
import './teams';

// new modules structure
require('./modules/users');

import './modules/users';
7 changes: 7 additions & 0 deletions config/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ var config = {
modules: false,
assets: true,
}),

// fix legacy jQuery plugins which depend on globals
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
}),
],

resolve: {
Expand Down
2 changes: 1 addition & 1 deletion spec/support/wait_for_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
module WaitForEvents
# Wait for all the AJAX requests to have concluded.
def wait_for_ajax
wait_until_zero("jQuery.active")
wait_until_zero("$.active")
end

# Wait for all the effects on the given selector to have concluded.
Expand Down

0 comments on commit efbff08

Please sign in to comment.