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

Feature: Optionally include JS library within generated file #79

Closed
ardani opened this issue Dec 29, 2016 · 9 comments
Closed

Feature: Optionally include JS library within generated file #79

ardani opened this issue Dec 29, 2016 · 9 comments
Assignees
Milestone

Comments

@ardani
Copy link

ardani commented Dec 29, 2016

Hi @rmariuzzo ,
this is great package, very usefull, i try this for my project now.
i have a problem , how to include result generate lang.js to webpack?
i try using this code but error

import Lang from 'lang.js';
require('./localize');

error message Uncaught ReferenceError: Lang is not defined
any solution for me?
thanks

@rmariuzzo
Copy link
Owner

If you run this:

import Lang from 'lang.js';

console.log(Lang)

What does it print?

@ardani
Copy link
Author

ardani commented Dec 29, 2016

if use

import Lang from 'lang.js';
const lang = new Lang();
console.log(lang)

it work, but if i use import file message.js from generate php artisan lang:js and import it on file js error if compile using webpack show error Lang is not defined

@ardani
Copy link
Author

ardani commented Dec 29, 2016

for now i modified with add option in command --message-only and template only_messages.js like this
#41199f8

let me know if any better solution
thanks

@rmariuzzo
Copy link
Owner

@ardani this looks great! What do you think @vluzrmos @a-komarev @gpopoteur about providing the option for generating the messages without the lib integrated? I think that proposal is pragmatic.

@antonkomarev
Copy link
Collaborator

@rmariuzzo I think this could be useful feature.

@rmariuzzo
Copy link
Owner

@a-komarev I also share the same feeling on this. However, I would suggest to use another parameter name such as:

# Include the lang.js library (by default).
php artisan lang:js --lib

# Do not include the lang.js library.
php artisan lang:js --no-lib

What do you think @a-komarev ?

@antonkomarev
Copy link
Collaborator

@rmariuzzo Good one!

@rmariuzzo
Copy link
Owner

Hey @ardani! Could you create a PR to develop branch with your changes + my comments?

@ardani
Copy link
Author

ardani commented Dec 29, 2016

Ok @rmariuzzo

@rmariuzzo rmariuzzo added this to the 1.3.6 milestone Jan 5, 2017
@rmariuzzo rmariuzzo self-assigned this Jan 5, 2017
@rmariuzzo rmariuzzo modified the milestones: 1.3.6, 1.4.0 Jan 7, 2017
@rmariuzzo rmariuzzo changed the title how to include result from generate lang.js in webpack? Feature: Optionally include JS library within generated file Jan 7, 2017
@rmariuzzo rmariuzzo added feature and removed bug labels Feb 1, 2017
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

3 participants