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

Load via npm as module #24

Closed
Termina1 opened this issue Apr 17, 2015 · 3 comments · Fixed by #40
Closed

Load via npm as module #24

Termina1 opened this issue Apr 17, 2015 · 3 comments · Fixed by #40
Assignees

Comments

@Termina1
Copy link

Now, there is no way to load t3js properly via browserify or webpack, as package.json does not have any main file entry, so I can't just write:

import Box from "t3js";

But it would be very nice to have such opportunity (not to use global Box variable, but the one exported by module).

@nzakas
Copy link
Contributor

nzakas commented Apr 17, 2015

Agreed. After a bit of investigation, it looks like this would be achievable fairly easily by turning the T3 source files into CommonJS format and using browserify to build the files in /dist

@j3tan j3tan self-assigned this Apr 17, 2015
@j3tan
Copy link
Contributor

j3tan commented Apr 17, 2015

I'll handle the CommonJS/browserify changes

j3tan added a commit that referenced this issue Apr 20, 2015
- adding proxyquire for testing browserified source files
- modified tests to use CommonJS
- modified build process to account for browserification
- downgraded karma-coverage to 0.2.6 to support browserify-istanbul
- updated ESLint rules to account for CommonJS changes

fixes #24
j3tan added a commit that referenced this issue Apr 20, 2015
- adding proxyquire for testing browserified source files
- modified tests to use CommonJS
- modified build process to account for browserification
- downgraded karma-coverage to 0.2.6 to support browserify-istanbul
- updated ESLint rules to account for CommonJS changes

fixes #24
j3tan added a commit that referenced this issue Apr 20, 2015
- adding proxyquire for testing browserified source files
- modified tests to use CommonJS
- modified build process to account for browserification
- downgraded karma-coverage to 0.2.6 to support browserify-istanbul
- updated ESLint rules to account for CommonJS changes

fixes #24
@mbinette
Copy link

If going the Browserify route, it would probably be good to go a little further and write these as ES6 Modules. A lot of projects are moving in that direction and with ES6 being passed this June, it isn't too early in the process. Then you could use the ES6 Modules directly if your project already uses ES6 and a transpiler or you could use Browserify to create standard ES5 code or CommonJS modules. ES6 Modules don't require any other ES6 features to be used so the code itself doesn't have to change any more than you already changed for CommonJS.

j3tan added a commit that referenced this issue Apr 21, 2015
- adding proxyquire for testing browserified source files
- modified tests to use CommonJS
- modified build process to account for browserification
- downgraded karma-coverage to 0.2.6 to support browserify-istanbul
- updated ESLint rules to account for CommonJS changes

fixes #24
j3tan added a commit that referenced this issue Apr 21, 2015
- wrapping t3 with a module.exports shim

fixes #24
j3tan added a commit that referenced this issue Apr 22, 2015
- wrapping t3 with a module.exports shim

fixes #24
j3tan added a commit that referenced this issue Apr 22, 2015
- wrapping t3 with a module.exports shim

fixes #24
j3tan added a commit that referenced this issue Apr 23, 2015
- wrapping t3 with a module.exports shim

fixes #24
@j3tan j3tan closed this as completed in #40 Apr 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants