auto-polyfills-webpack-plugin
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -7,2 +7,8 @@ # auto-polyfills-webpack-plugin | ||
- 3508d49b: fixed bugs of can't send correct core-js-builder options | ||
## 1.0.1 | ||
### Patch Changes | ||
- 403d780e: release auto-polyfills-webpack-plugin, and support it in ko | ||
@@ -9,0 +15,0 @@ |
15
index.ts
@@ -17,4 +17,2 @@ import { createHash } from 'crypto'; | ||
import builder from 'core-js-builder'; | ||
// @ts-ignore | ||
import compat from 'core-js-compat'; | ||
@@ -26,3 +24,3 @@ export type IOpts = { | ||
customPrefix?: string; | ||
excludeCoreJsModules?: string[]; | ||
excludeCoreJsModules?: (string | RegExp)[]; | ||
}; | ||
@@ -76,3 +74,2 @@ | ||
const [_, originHash] = baseName.split(this.strBeforeHash); | ||
console.log(originHash, this.targetHash); | ||
if (originHash === this.targetHash) { | ||
@@ -130,3 +127,4 @@ polyfillExist = true; | ||
const bundleContent = await builder({ | ||
target: this.browserslistQuery, | ||
targets: this.browserslistQuery, | ||
exclude: this.opts.excludeCoreJsModules, | ||
}); | ||
@@ -160,8 +158,3 @@ const { code } = await minify(bundleContent); | ||
const content = readFileSync(this.opts.browserslistPath!, 'utf-8'); | ||
const { targets } = compat({ | ||
targets: content, | ||
exclude: this.opts.excludeCoreJsModules, | ||
version: this.coreJsVersion, | ||
}); | ||
return targets; | ||
return content; | ||
} catch (ex) { | ||
@@ -168,0 +161,0 @@ throw ex; |
@@ -7,3 +7,3 @@ import { Compiler } from 'webpack'; | ||
customPrefix?: string; | ||
excludeCoreJsModules?: string[]; | ||
excludeCoreJsModules?: (string | RegExp)[]; | ||
}; | ||
@@ -22,4 +22,4 @@ declare class AutoPolyfillsWebpackPlugin { | ||
get coreJsVersion(): any; | ||
get browserslistQuery(): any; | ||
get browserslistQuery(): string; | ||
} | ||
export default AutoPolyfillsWebpackPlugin; |
@@ -13,4 +13,2 @@ "use strict"; | ||
const core_js_builder_1 = __importDefault(require("core-js-builder")); | ||
// @ts-ignore | ||
const core_js_compat_1 = __importDefault(require("core-js-compat")); | ||
class AutoPolyfillsWebpackPlugin { | ||
@@ -48,3 +46,2 @@ constructor(opts = {}) { | ||
const [_, originHash] = baseName.split(this.strBeforeHash); | ||
console.log(originHash, this.targetHash); | ||
if (originHash === this.targetHash) { | ||
@@ -83,3 +80,4 @@ polyfillExist = true; | ||
const bundleContent = await (0, core_js_builder_1.default)({ | ||
target: this.browserslistQuery, | ||
targets: this.browserslistQuery, | ||
exclude: this.opts.excludeCoreJsModules, | ||
}); | ||
@@ -112,8 +110,3 @@ const { code } = await (0, terser_1.minify)(bundleContent); | ||
const content = (0, fs_1.readFileSync)(this.opts.browserslistPath, 'utf-8'); | ||
const { targets } = (0, core_js_compat_1.default)({ | ||
targets: content, | ||
exclude: this.opts.excludeCoreJsModules, | ||
version: this.coreJsVersion, | ||
}); | ||
return targets; | ||
return content; | ||
} | ||
@@ -120,0 +113,0 @@ catch (ex) { |
{ | ||
"name": "auto-polyfills-webpack-plugin", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "a webpack plugin for auto generate polyfills", | ||
@@ -20,3 +20,2 @@ "main": "lib/index.js", | ||
"core-js-builder": "^3.24.1", | ||
"core-js-compat": "^3.24.1", | ||
"terser": "^5.15.0" | ||
@@ -23,0 +22,0 @@ }, |
5
13880
302
- Removedcore-js-compat@^3.24.1