browserify build not found
Closed this issue · 9 comments
hi there,
I follow your instruction to use pngjs3 on browser, but it seems to me the library does not have any build for browser yet. Please correct me if I am wrong!
It works for me in the browser - what is it you're trying to do?
Thanks for your response, as I am quite new for this browserify transform thing, pardon me for my misunderstand or silly configuration.
here is my wepack configure.common.bable.js
import { join, resolve } from 'path';
import Bundle from './bundle.json';
const include = join(__dirname, 'src');
export default {
entry: {
[Bundle.main]: ['@babel/polyfill', './src/index.js'],
[Bundle.min]: ['@babel/polyfill', './src/index.js'],
},
mode: 'development',
devtool: 'inline-source-map',
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader',
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.js$/,
enforce: 'post',
loader: 'ify-loader',
}
],
}
};
on my code, I import in both ways:
import { PNG } from 'pngjs3';
or
import { PNG } from 'pngjs3/browser';
and none of them works.
here is my browserify declaration inside the package.json
"browserify": {
"transform": [
"pngjs3"
]
},
hi,
I finally get it works, thanks for your great package.
You're welcome.
What was the problem? In case you've missed it 😁 : https://www.reddit.com/r/ProgrammerHumor/comments/9rqms9/what_should_happen/
Please take the time to write an answer or even a suggestion for how the package docs may be improved upon to help others.
ah, it just works without clear explanation, I think the document should be updated as:
import { PNG } from 'pngjs3';
not this:
import { PNG } from 'pngjs3/browser';
aloha, I get one thing could be the cause of my issue some days earlier, this code does not work even on node environment (v11):
const data = fs.readFileSync('in.png');
const png = PNG.sync.read(data);
here is the error:
TypeError: "list" argument must be an Array of Buffers
at Function.concat (/Users/huynh/github/causality/node_modules/pngjs3/dist/pngjs3.js:569:13)
at parse (/Users/huynh/github/causality/node_modules/pngjs3/dist/pngjs3.js:6921:28)
at Object.read (/Users/huynh/github/causality/node_modules/pngjs3/dist/pngjs3.js:7280:10)
at Object.<anonymous> (/Users/huynh/github/causality/examples/utils/png.js:6:22)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
I've added version 10 to Travis but everything works. Could you clone the package and then check with npm run test
if everything works?
I'm currently changing the API to a more consistent form without the PNG-object-centered export. I've also updated the README. It will be released soon, it would be nice to include your issuel.
Thanks @gforge , I run your test and all pass.
As I am using your package on my project, I think I will wait until you finish your API change and upgrade to your newest version.