提交 8c214949 编写于 作者: G Guy Bedford 提交者: Joe Haddad

polyfills

上级 9c2e43a3
/* globals __webpack_hash__ */
import fetch from 'unfetch'
import fetch from 'next/dist/build/polyfills/unfetch'
import EventSourcePolyfill from './event-source-polyfill'
import { getEventSourceWrapper } from './error-overlay/eventsource'
import { setupPing } from './on-demand-entries-utils'
......
......@@ -28,9 +28,9 @@ SOFTWARE.
import { getEventSourceWrapper } from './eventsource'
import formatWebpackMessages from './format-webpack-messages'
import * as ErrorOverlay from 'react-error-overlay'
import stripAnsi from 'strip-ansi'
import stripAnsi from 'next/dist/compiled/strip-ansi'
import { rewriteStacktrace } from './source-map-support'
import fetch from 'unfetch'
import fetch from 'next/dist/build/polyfills/unfetch'
// This alternative WebpackDevServer combines the functionality of:
// https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js
......
......@@ -2,7 +2,7 @@
// Improved version of https://github.com/Yaffle/EventSource/
// Available under MIT License (MIT)
// Only tries to support IE11 and nothing below
import fetch from 'unfetch'
import fetch from 'next/dist/build/polyfills/unfetch'
var document = window.document
var Response = window.Response
......
/* global location */
import fetch from 'unfetch'
import fetch from 'next/dist/build/polyfills/unfetch'
import { getEventSourceWrapper } from './error-overlay/eventsource'
let evtSource
......
......@@ -21,7 +21,7 @@ import {
if (!('finally' in Promise.prototype)) {
// eslint-disable-next-line no-extend-native
Promise.prototype.finally = require('finally-polyfill')
Promise.prototype.finally = require('next/dist/build/polyfills/finally-polyfill.min')
}
const data = JSON.parse(document.getElementById('__NEXT_DATA__').textContent)
......
import '@next/polyfill-nomodule'
import 'next/dist/build/polyfills/polyfill-nomodule'
......@@ -59,13 +59,11 @@
"dependencies": {
"@ampproject/toolbox-optimizer": "2.0.1",
"@babel/runtime": "7.7.2",
"@next/polyfill-nomodule": "9.3.4-canary.0",
"autodll-webpack-plugin": "0.4.2",
"cache-loader": "4.1.0",
"css-loader": "3.3.0",
"cssnano-simple": "1.0.0",
"file-loader": "4.2.0",
"finally-polyfill": "0.1.0",
"fork-ts-checker-webpack-plugin": "3.1.1",
"ignore-loader": "0.1.2",
"jest-worker": "24.9.0",
......@@ -86,7 +84,6 @@
"style-loader": "1.0.0",
"styled-jsx": "3.2.5",
"thread-loader": "2.1.3",
"unfetch": "4.1.0",
"url": "0.11.0",
"use-subscription": "1.1.1",
"watchpack": "2.0.0-beta.13",
......@@ -115,6 +112,7 @@
"@babel/preset-react": "7.7.0",
"@babel/preset-typescript": "7.7.2",
"@babel/types": "7.7.4",
"@next/polyfill-nomodule": "9.3.4-canary.0",
"@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0",
"@taskr/watch": "1.1.0",
......@@ -173,6 +171,7 @@
"dotenv-expand": "5.1.0",
"escape-string-regexp": "2.0.0",
"etag": "1.8.1",
"finally-polyfill": "0.1.0",
"find-up": "4.0.0",
"fresh": "0.5.2",
"gzip-size": "5.1.1",
......@@ -198,6 +197,7 @@
"terser": "4.4.2",
"text-table": "0.2.0",
"typescript": "3.7.3",
"unfetch": "4.1.0",
"unistore": "3.4.1"
},
"engines": {
......
const notifier = require('node-notifier')
const relative = require('path').relative
export async function next__polyfill_nomodule(task, opts) {
await task
.source(
opts.src ||
relative(__dirname, require.resolve('@next/polyfill-nomodule'))
)
.target('dist/build/polyfills')
}
export async function finally_polyfill(task, opts) {
await task
.source(
opts.src || relative(__dirname, require.resolve('finally-polyfill'))
)
.target('dist/build/polyfills')
}
export async function unfetch(task, opts) {
await task
.source(opts.src || relative(__dirname, require.resolve('unfetch')))
.target('dist/build/polyfills')
}
export async function browser_polyfills(task) {
await task.parallel([
'next__polyfill_nomodule',
'finally_polyfill',
'unfetch',
])
}
const externals = {
'@babel/core': 'next/dist/compiled/babel--core',
'@babel/helper-plugin-utils': 'next/dist/compiled/babel--helper-plugin-utils',
......@@ -553,6 +584,7 @@ export async function ncc_unistore(task, opts) {
export async function precompile(task) {
await task.parallel([
'browser_polyfills',
'ncc_amphtml_validator',
'ncc_arg',
'ncc_async_retry',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册