Comments (5)
The code:
js := bytes.Buffer{}
dat, err := ioutil.ReadFile(fname)
if L.Check(err, `File doesn't exists: `+fname) == nil {
dat, err = min.MinifyBytes(`text/js`, dat)
js.Write(dat)
js.WriteRune(';')
}
from minify.
I cannot reproduce, are you sure you update tdewolff/parse lately for I pushed tdewolff/parse@9e980e5 with a bugfix.
from minify.
Yes, the error still the same..
from minify.
minimum code to reproduce:
package main
import `fmt`
import `io/ioutil`
import `github.com/tdewolff/minify`
import `github.com/tdewolff/minify/js`
func main() {
min := minify.NewMinifier()
min.Add("text/js", js.Minify)
fname := `/tmp/ace.js`
dat, err := ioutil.ReadFile(fname)
if err == nil {
dat, err = min.MinifyBytes(`text/js`, dat)
if err == nil {
fmt.Println(`ok`)
} else {
fmt.Printf("%# v\n", err)
}
} else {
fmt.Printf("%# v\n", err)
}
}
output:
&errors.errorString{s:"max buffer exceeded"}
ace.js downloaded from https://raw.githubusercontent.com/ajaxorg/ace-builds/master/src/ace.js
from minify.
The problem is that ace.js contains a very very long string which exceeds the maximum buffer limit. This limit is set to 4096 bytes in https://github.com/tdewolff/parse/blob/master/shiftbuffer.go#L10
But the string is 11508 characters long, I drastically increased the limit, but one can do this manually too. tdewolff/parse@dd3690f
Additionally, this is fixed by 69eb7cf by using the provided slice which sets no size limit.
from minify.
Related Issues (20)
- Bug: return statement causes error HOT 2
- Max amount of exclude statements HOT 1
- Docker hub tags HOT 3
- return statement causes error in onclick HOT 2
- Minify v2.20.5 removes essential part of JS functions HOT 2
- Regression with 2.20.5 (from 2.20.1) HOT 2
- Tests broken on v2.80.2 HOT 1
- Compile error in v2.20.8? HOT 2
- WARNING: preserve ownership not supported on platform HOT 11
- High CPU Usage After Minification HOT 3
- Since version 2.20.8 I got error "panic: runtime error: index out of range [nnn] with length nnn" HOT 3
- CSS with @layer is not well compressed HOT 1
- Minify private methods and private properties of JS classes HOT 3
- JS: "SyntaxError: Invalid or unexpected token" after minifying pdfmake.js HOT 1
- JS: '\u0022' minified to """ HOT 1
- Breaks on current jQuery versions HOT 2
- Comments beginning with # are not removed HOT 1
- Middleware skips some mimetype HOT 3
- Issues with deprecation of KeepConditionalComments HOT 1
- `minify` package for Alpine Linux doesn't show version. HOT 2
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 minify.