@@ -1632,3 +1632,46 @@ func TestLoaderBundleWithTypeJSONOnlyDefaultExport(t *testing.T) {
16321632` ,
16331633 })
16341634}
1635+
1636+ func TestLoaderJSONPrototype (t * testing.T ) {
1637+ loader_suite .expectBundled (t , bundled {
1638+ files : map [string ]string {
1639+ "/entry.js" : `
1640+ import data from "./data.json"
1641+ console.log(data)
1642+ ` ,
1643+ "/data.json" : `{
1644+ "": "The property below should be converted to a computed property:",
1645+ "__proto__": { "foo": "bar" }
1646+ }` ,
1647+ },
1648+ entryPaths : []string {"/entry.js" },
1649+ options : config.Options {
1650+ Mode : config .ModeBundle ,
1651+ AbsOutputFile : "/out.js" ,
1652+ MinifySyntax : true ,
1653+ },
1654+ })
1655+ }
1656+
1657+ func TestLoaderJSONPrototypeES5 (t * testing.T ) {
1658+ loader_suite .expectBundled (t , bundled {
1659+ files : map [string ]string {
1660+ "/entry.js" : `
1661+ import data from "./data.json"
1662+ console.log(data)
1663+ ` ,
1664+ "/data.json" : `{
1665+ "": "The property below should NOT be converted to a computed property for ES5:",
1666+ "__proto__": { "foo": "bar" }
1667+ }` ,
1668+ },
1669+ entryPaths : []string {"/entry.js" },
1670+ options : config.Options {
1671+ Mode : config .ModeBundle ,
1672+ AbsOutputFile : "/out.js" ,
1673+ MinifySyntax : true ,
1674+ UnsupportedJSFeatures : es (5 ),
1675+ },
1676+ })
1677+ }
0 commit comments