Comments (18)
What if we declare main
to point to dist/clipboard.js
? https://github.com/substack/browserify-handbook#browser-field /cc @mauriciosoares
from clipboard.js.
damn, this browser-field might do the trick
I was trying to point main directly to the dist file, but there was a lot of "require" errors in the terminal, since all the required files are already bundled in the dist file.
This might be a solution 👍
from clipboard.js.
@zenorocha, tested here with my lib, and I think that will actually work.
will you work on that?
from clipboard.js.
HAHAHAHAAH
Nope, can you test with Node and send a PR?
from clipboard.js.
Sure, I'll probably work on that tonight.
from clipboard.js.
Hey @zenorocha, just did a PR #19
I'll take a look in how I can improve the tests for requirejs and commonjs projects, in the meanwhile, this PR has tests for projects that uses browserify.
from clipboard.js.
@ibc it should be fixed as of https://github.com/zenorocha/clipboard.js/releases/tag/v1.3.1
Could you test and let us know?
from clipboard.js.
If I add the lib (master branch) into the package.json of my browserify based project, calling browserify
on the project fails because babelify
is required. It is included in the devDependencies
of the lib, but those are not installed. babelify
should be placed under dependencies
. If so, it does work :)
from clipboard.js.
I moved to dependencies as requested ;)
from clipboard.js.
browserify
does not need to be added into dependencies
;)
from clipboard.js.
I mean: is up to me whether I'm building a browserify based project or not. If so, when browserify "compiles" clipboard.js it will honor the "browserify" data in package.json, but browserify should not be placed in dependencies
.
from clipboard.js.
But you can't run babelify without browserify. I'm confused.
from clipboard.js.
Example usecase:
- I build a JS library named myApp.js intended for browser usage.
- myApp.js is made using the Node's way (
require('xxxx');
,package.json
, etc). - My deps are the node-debug module and
clipboard.js
(they are included in thedependencies
field of my package.json). - myApp.js includes a Gruntfile or gulpfile with a
browserify
task to build the "browserified" librarydist/myapp.js
, so I addbrowserify
into mydevDependencies
.
When I run my browserify task it takes the debug
module and clipboard
module. When browserifing clipboard
browserify realizes that there is a browserify
field in its package.json, so it honors those settings (in this case, it loads the babelify
transform).
That's all. I won't use the browserify
module within clipboard
but the browserify
module I set into my project's package.json
. Hope it's clear now :)
from clipboard.js.
Uhm...one approach is to create a clipboard.transpiled.js into dist folder and point it in "browser" field(I can do this with a PR using babel compiler as dev dependencie).
Then neither browserify nor babelify would be a main dependency, and the install would turn faster on NPM 3. Not to mention webpack and jspm could reach this file as well without any transpiler required.
from clipboard.js.
However we have src/clipboard-action.js to be transpiled as well . Maybe create a folder dist/transpiled and point it in "browser" field. 😞
from clipboard.js.
Example: heldr@b041513
drawback: Babel's _classCallCheck is repeated twice
from clipboard.js.
Fixed in v1.5.3
from clipboard.js.
nice! 😎
from clipboard.js.
Related Issues (20)
- Transition from document.execCommand to navigator.clipboard
- Copy/Paste does not work with ' character HOT 2
- How we can force/test error event? HOT 3
- Add New Line to Clipboard HOT 6
- Docs to explain copy all code blocks on a page at once. HOT 2
- Html attribute conflict HOT 1
- Need event.stopImmediatePropagation() to prevent the event from triggering a redirect HOT 1
- clipboardjs not working modaal js HOT 2
- Doesn't work properly in Safari 16.5.1 HOT 4
- how about dbclick action ,and then twice copy result
- Enhance the container option HOT 5
- if 2 #copy elements then some bugs HOT 4
- window.execCommand execute failed but success event be triggered!!
- innerText or Similar Removes Double Spaces
- It won't work on iOS16 or above,15 and the following systems are normal HOT 1
- Demo page uses old script with focus loss bug
- Page hangs after copy the text
- Client potential XSS - feedback needed
- Avoid serving legacy JavaScript to modern browsers @babel/plugin-transform-classes HOT 1
- Regression in 2.0.9 leading to values other than type string (number, boolean) cannot be copied
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clipboard.js.