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

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

Closed
larryisthere opened this issue Feb 27, 2014 · 8 comments
Closed
Assignees
Milestone

Comments

@larryisthere
Copy link

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
Owner

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?

@larryisthere
Copy link
Author

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 Waxolunist modified the milestones: 0.2.10 (current development), v0.3.0 (wip) Mar 5, 2014
@Waxolunist
Copy link
Owner

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

@Waxolunist Waxolunist modified the milestones: v0.3.0 (wip), 0.2.10 (current development) Mar 6, 2014
@Waxolunist Waxolunist self-assigned this Mar 6, 2014
Waxolunist added a commit that referenced this issue Mar 6, 2014
@Waxolunist
Copy link
Owner

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.

@patrick-radius
Copy link

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
Owner

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.

@patrick-radius
Copy link

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

@Waxolunist
Copy link
Owner

no problem

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

3 participants