AMD module support
See original GitHub issueHi.
I kinda cannot get your package to work, maybe you can help me.
When I do
var Lang = require('lang.js')
var lang = new Lang({
messages: {
"en.foo": {
bar: 'baz'
},
"pl.foo": {
bar: 'quz'
}
},
locale: 'pl',
fallback: 'en'
})
I get an error saying
Uncaught TypeError: Lang is not a constructor
Same thing happens when I replace require
with import
:
import Lang from 'lang.js';
After import/require the Lang object looks like this:
{
locale: "en",
fallback: undefined,
messages: undefined
}
Setup
Dependencies
{
"gulp": "^3.9.1",
"gulp-shell": "^0.5.2",
"jquery": "^3.1.0",
"lang.js": "^1.1.1",
"laravel-echo": "^1.1.0",
"laravel-elixir": "^6.0.0-11",
"laravel-elixir-vue-2": "^0.2.0",
"laravel-elixir-webpack-official": "^1.0.2",
// and other like Vue or Moment.js
}
gulpfile.js
const elixir = require('laravel-elixir');
const shell = require('gulp-shell');
require('laravel-elixir-vue-2');
var Task = elixir.Task;
elixir.extend('langjs', function(path) {
new Task('langjs', function() {
gulp.src('').pipe(shell('php artisan lang:js resources/assets/js/messages.js'));
});
});
elixir(mix => {
mix.sass('app.scss')
.langjs()
.webpack('app.js')
});
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (9 by maintainers)
Top Results From Across the Web
Why AMD? - RequireJS
This page talks about the design forces and use of the Asynchronous Module Definition (AMD) API for JavaScript modules, the module API supported...
Read more >Asynchronous module definition - Wikipedia
Asynchronous module definition (AMD) is a specification for the programming language JavaScript. It defines an application programming interface (API) that ...
Read more >Introduction to AMD Modules - Dojo Toolkit Tutorial
Dojo supports modules written in the Asynchronous Module Definition (AMD) format ... In this tutorial, we explain the basics of understanding and using...
Read more >What are AMD modules? Fetch your sick bag - Jim Fisher
ECMAScript modules are not acceptable because they don't have wide enough support yet. So, enter Asynchronous Module Definition, or AMD.
Read more >Writing Modular JavaScript With AMD, CommonJS & ES ...
Learn how to write modular JavaScript using modern synchronous and asynchronous formats such as AMD and CommonJS.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@KKSzymanowski thank you for validate.
@jartaud can you try with 1.1.3 and give us more details.
@jartaud Didn’t work for me yesterday,because npm downloaded 1.1.2. Today I forced 1.1.3 and it works. Edit: you can check which version is installed by
npm ls lang.js
.Thank you @rmariuzzo.