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

[CLOSED] RequireJS - Errors after updating from 0.2.6 to 0.2.9 via bower #40

Closed
Waxolunist opened this issue Sep 29, 2014 · 8 comments
Closed
Milestone

Comments

@Waxolunist
Copy link
Contributor

Issue by larryisthere
Thursday Feb 27, 2014 at 12:46 GMT
Originally opened as Waxolunist/bootstrap3-wysihtml5-bower#40


With 0.2.6 everything worked just fine, but errors below come with 0.2.9.
Anyone knows how to fix them?

[Error] TypeError: 'undefined' is not an object (evaluating 'a.commands') (bootstrap3-wysihtml5.all.min.js, line 2)
[Debug] Locale 'en' not found. Available locales are: . Falling back to 'en'. (bootstrap3-wysihtml5.all.min.js, line 2)
[Error] TypeError: 'undefined' is not a constructor (evaluating 'new b.Editor(this.el[0],c)')
createEditor (bootstrap3-wysihtml5.all.min.js, line 2)
d (bootstrap3-wysihtml5.all.min.js, line 2)
(anonymous function) (bootstrap3-wysihtml5.all.min.js, line 2)
each (jquery.js, line 590)
each (jquery.js, line 237)
bypassDefaults (bootstrap3-wysihtml5.all.min.js, line 2)
shallowExtend (bootstrap3-wysihtml5.all.min.js, line 2)
init (bootstrap3-wysihtml5.all.min.js, line 2)
wysihtml5 (bootstrap3-wysihtml5.all.min.js, line 2)
initEls (modalLayer.js, line 78)
ModalAritcle (modalLayer.js, line 19)
data (_player.js, line 24)
(anonymous function) (main.js, line 8)
execCb (require.js, line 1650)
check (require.js, line 866)
(anonymous function) (require.js, line 1113)
(anonymous function) (require.js, line 132)
(anonymous function) (require.js, line 1156)
each (require.js, line 57)
emit (require.js, line 1155)
check (require.js, line 917)
(anonymous function) (require.js, line 1113)
(anonymous function) (require.js, line 132)
(anonymous function) (require.js, line 1156)
each (require.js, line 57)
emit (require.js, line 1155)
check (require.js, line 917)
(anonymous function) (require.js, line 1113)
(anonymous function) (require.js, line 132)
(anonymous function) (require.js, line 1156)
each (require.js, line 57)
emit (require.js, line 1155)
check (require.js, line 917)
enable (require.js, line 1143)
init (require.js, line 774)
callGetModule (require.js, line 1170)
completeLoad (require.js, line 1564)
onScriptLoad (require.js, line 1671)

@Waxolunist
Copy link
Contributor Author

Comment by Waxolunist
Friday Feb 28, 2014 at 14:43 GMT


First, 0.2.9 is still alpha. 0.2.8 should be stable.
Can you give an example or better a fiddle, how you are using the library?

@Waxolunist Waxolunist added this to the v0.3.0 milestone Sep 29, 2014
@Waxolunist
Copy link
Contributor Author

Comment by larryisthere
Tuesday Mar 04, 2014 at 12:32 GMT


Using requirejs to manage modules, I got following structure and correlative files.

main.js

requirejs.config({
  "paths": {
    ...
    'datetimepicker': 'bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min',
    'myModule': 'path/to/myModule',
    ...
  },  
  shim: {
    'wysihtml5': ['handlebars', 'bootstrap'],
  }

myModule.js

define(['bootstrap', 'wysihtml5', 'datetimepicker'], function(){
  ...
  var _editor  = $(element).wysihtml5();
  var editor   = _editor.data('wysihtml5').editor;
  ...
});

Even if I use 0.2.9 stable or 0.3.0 alpha, the precedent exception is there, so I've to specific the version of 0.2.8 to avoid that.

@Waxolunist
Copy link
Contributor Author

Comment by Waxolunist
Wednesday Mar 05, 2014 at 08:49 GMT


I will have a look, how to add amd support.

@Waxolunist
Copy link
Contributor Author

Comment by Waxolunist
Thursday Mar 06, 2014 at 07:29 GMT


Please have a look at the latest v0.3.0 version. RequireJS support is now built in.
Don't be afraid of the alpha status.
It's stable, it just does not have the features and the clean code base I want.

If you want to add requirejs support to the maintenance versions 0.2.x you are on your own.

@Waxolunist
Copy link
Contributor Author

Comment by pradius-fut
Tuesday Mar 11, 2014 at 16:19 GMT


I don't seem to be able to figure out how to use this v.0.3.0 version with bower and RequireJS support.
I've added

'wysihtml5': '../vendor/bower/bootstrap3-wysihtml5-bower/dist/bootstrap3-wysihtml5.all.min'

to my paths and

but when i try to initialize a wysiwyg instance i get:
undefined is not a funtction on the line that says:

this.$element.wysihtml5('deepExtend',{

Also, i use github.com/yeoman/grunt-bower-requirejs to automatically include the bower dependencies in requirejs config.
But by default it includes

../vendor/bower/bootstrap3-wysihtml5-bower/dist/bootstrap3-wysihtml5.min

and not

../vendor/bower/bootstrap3-wysihtml5-bower/dist/bootstrap3-wysihtml5.all.min

@Waxolunist
Copy link
Contributor Author

Comment by Waxolunist
Tuesday Mar 11, 2014 at 21:25 GMT


Have you seen the version in examples of the 0.3 branch? https://github.com/Waxolunist/bootstrap3-wysihtml5-bower/tree/v0.3.0-wip/examples

It uses the amd-versions in the folder amd.

I also updated the readme and added examples for requirejs to it.

The automatic include is because the all-inclusive version is not the main of this package.

@Waxolunist
Copy link
Contributor Author

Comment by pradius-fut
Tuesday Mar 11, 2014 at 23:02 GMT


ah yes, i think it works now, sorry about that

@Waxolunist
Copy link
Contributor Author

Comment by Waxolunist
Friday Mar 14, 2014 at 09:58 GMT


no problem

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

No branches or pull requests

1 participant