Next.js: Babel polyfill이 μ£Όμž…λ˜μ§€ μ•Šμ€ 것 κ°™μŠ΅λ‹ˆλ‹€.

에 λ§Œλ“  2017λ…„ 07μ›” 05일  Β·  34μ½”λ©˜νŠΈ  Β·  좜처: vercel/next.js

λ‚΄ μ•±μ—μ„œ 였λ₯˜λ₯Ό μˆ˜μ •ν•˜κΈ° μœ„ν•΄ IE11을 μ§€μ›ν•˜λ €κ³ ν•©λ‹ˆλ‹€.
TypeError: Object doesn't support property or method 'find'

λ‹€μŒ 2.4.6 ν•˜μ§€λ§Œ μ΅œμ‹  λ² νƒ€μ—μ„œλ„ μž‘λ™ν•˜μ§€ μ•ŠμŒ

λ‹€μŒ κ΅¬μ„±μœΌλ‘œ babel-preset-env 와 ν•¨κ»˜ μ‚¬μš©μž 지정 .babelercλ₯Ό μΆ”κ°€ν–ˆμŠ΅λ‹ˆλ‹€.

{
  "presets": [
    "es2015",
    "react",
    "next/babel",
    "stage-0",
    [ "env", {
      "targets": {
        "safari": 10,
        "ie": 11
      },
      "modules": false,
      "useBuiltIns": true,
      "debug": true
    }]
  ],
}

디버그 ν”Œλž˜κ·Έλ₯Ό ν™œμ„±ν™”ν•˜μ—¬ μ‹œμž‘ν•  λ•Œ λ‹€μŒ 둜그λ₯Ό μ–»μŠ΅λ‹ˆλ‹€. μ΄λŠ” polyfill이 μΆ”κ°€λ˜μ—ˆμŒμ„ μ˜λ―Έν•˜λŠ” 것 κ°™μŠ΅λ‹ˆλ‹€.

babel-preset-env: `DEBUG` option

Using targets:
{
  "safari": "10",
  "ie": "11"
}

Modules transform: false

Using plugins:
  check-es2015-constants {"ie":"11"}
  transform-es2015-arrow-functions {"ie":"11"}
  transform-es2015-block-scoping {"ie":"11"}
  transform-es2015-classes {"ie":"11"}
  transform-es2015-computed-properties {"ie":"11"}
  transform-es2015-destructuring {"ie":"11"}
  transform-es2015-duplicate-keys {"ie":"11"}
  transform-es2015-for-of {"ie":"11"}
  transform-es2015-function-name {"ie":"11"}
  transform-es2015-literals {"ie":"11"}
  transform-es2015-object-super {"ie":"11"}
  transform-es2015-parameters {"ie":"11"}
  transform-es2015-shorthand-properties {"ie":"11"}
  transform-es2015-spread {"ie":"11"}
  transform-es2015-sticky-regex {"ie":"11"}
  transform-es2015-template-literals {"ie":"11"}
  transform-es2015-typeof-symbol {"ie":"11"}
  transform-es2015-unicode-regex {"ie":"11"}
  transform-regenerator {"ie":"11"}
  transform-exponentiation-operator {"safari":"10","ie":"11"}
  transform-async-to-generator {"safari":"10","ie":"11"}
  syntax-trailing-function-commas {"ie":"11"}

Using polyfills:
  es6.typed.array-buffer {"ie":"11"}
  es6.typed.int8-array {"ie":"11"}
  es6.typed.uint8-array {"ie":"11"}
  es6.typed.uint8-clamped-array {"ie":"11"}
  es6.typed.int16-array {"ie":"11"}
  es6.typed.uint16-array {"ie":"11"}
  es6.typed.int32-array {"ie":"11"}
  es6.typed.uint32-array {"ie":"11"}
  es6.typed.float32-array {"ie":"11"}
  es6.typed.float64-array {"ie":"11"}
  es6.map {"ie":"11"}
  es6.set {"ie":"11"}
  es6.weak-map {"ie":"11"}
  es6.weak-set {"ie":"11"}
  es6.reflect.apply {"ie":"11"}
  es6.reflect.construct {"ie":"11"}
  es6.reflect.define-property {"ie":"11"}
  es6.reflect.delete-property {"ie":"11"}
  es6.reflect.get {"ie":"11"}
  es6.reflect.get-own-property-descriptor {"ie":"11"}
  es6.reflect.get-prototype-of {"ie":"11"}
  es6.reflect.has {"ie":"11"}
  es6.reflect.is-extensible {"ie":"11"}
  es6.reflect.own-keys {"ie":"11"}
  es6.reflect.prevent-extensions {"ie":"11"}
  es6.reflect.set {"ie":"11"}
  es6.reflect.set-prototype-of {"ie":"11"}
  es6.promise {"ie":"11"}
  es6.symbol {"ie":"11"}
  es6.object.assign {"ie":"11"}
  es6.object.is {"ie":"11"}
  es6.function.name {"ie":"11"}
  es6.string.raw {"ie":"11"}
  es6.string.from-code-point {"ie":"11"}
  es6.string.code-point-at {"ie":"11"}
  es6.string.repeat {"ie":"11"}
  es6.string.starts-with {"ie":"11"}
  es6.string.ends-with {"ie":"11"}
  es6.string.includes {"ie":"11"}
  es6.regexp.flags {"ie":"11"}
  es6.regexp.match {"ie":"11"}
  es6.regexp.replace {"ie":"11"}
  es6.regexp.split {"ie":"11"}
  es6.regexp.search {"ie":"11"}
  es6.array.from {"ie":"11"}
  es6.array.of {"ie":"11"}
  es6.array.copy-within {"ie":"11"}
  es6.array.find {"ie":"11"}
  es6.array.find-index {"ie":"11"}
  es6.array.fill {"ie":"11"}
  es6.array.iterator {"ie":"11"}
  es6.number.is-finite {"ie":"11"}
  es6.number.is-integer {"ie":"11"}
  es6.number.is-safe-integer {"ie":"11"}
  es6.number.is-nan {"ie":"11"}
  es6.number.epsilon {"ie":"11"}
  es6.number.min-safe-integer {"ie":"11"}
  es6.number.max-safe-integer {"ie":"11"}
  es6.math.acosh {"ie":"11"}
  es6.math.asinh {"ie":"11"}
  es6.math.atanh {"ie":"11"}
  es6.math.cbrt {"ie":"11"}
  es6.math.clz32 {"ie":"11"}
  es6.math.cosh {"ie":"11"}
  es6.math.expm1 {"ie":"11"}
  es6.math.fround {"ie":"11"}
  es6.math.hypot {"ie":"11"}
  es6.math.imul {"ie":"11"}
  es6.math.log1p {"ie":"11"}
  es6.math.log10 {"ie":"11"}
  es6.math.log2 {"ie":"11"}
  es6.math.sign {"ie":"11"}
  es6.math.sinh {"ie":"11"}
  es6.math.tanh {"ie":"11"}
  es6.math.trunc {"ie":"11"}
  es7.array.includes {"ie":"11"}
  es7.object.values {"safari":"10","ie":"11"}
  es7.object.entries {"safari":"10","ie":"11"}
  es7.object.get-own-property-descriptors {"safari":"10","ie":"11"}
  es7.string.pad-start {"ie":"11"}
  es7.string.pad-end {"ie":"11"}
  web.timers {"safari":"10","ie":"11"}
  web.immediate {"safari":"10","ie":"11"}
  web.dom.iterable {"safari":"10","ie":"11"}

κ·ΈλŸ¬λ‚˜ λŸ°νƒ€μž„μ— λ°°μ—΄μ—μ„œ .find () λ©”μ„œλ“œλ₯Ό 호좜 ν•  λ•Œ IE11μ—μ„œ μ—¬μ „νžˆ 였λ₯˜κ°€ λ°œμƒν•©λ‹ˆλ‹€.

폴리 필이 μ˜¬λ°”λ₯΄κ²Œ μ£Όμž…λ˜μ—ˆλŠ”μ§€ λ‹€μ‹œ ν™•μΈν•˜κΈ° μœ„ν•΄ ν•  μˆ˜μžˆλŠ” 일이 μžˆμŠ΅λ‹ˆκΉŒ?

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

λ‚΄κ°€ 가진 μœ μΌν•œ μˆ˜μ • 사항은 μ‚¬μš©μž μ •μ˜ layout.jsλ₯Ό μΆ”κ°€ν•˜κ³ 
<script src='https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.23.0/polyfill.min.js' />

λͺ¨λ“  34 λŒ“κΈ€

μƒ˜ν”Œ ν”„λ‘œμ νŠΈ @ https://github.com/jonaswindey/next-polyfill-bug

λ‚΄κ°€ 가진 μœ μΌν•œ μˆ˜μ • 사항은 μ‚¬μš©μž μ •μ˜ layout.jsλ₯Ό μΆ”κ°€ν•˜κ³ 
<script src='https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.23.0/polyfill.min.js' />

@arunoda μš°λ¦¬λŠ” 이것을 전에 λ³Έ 적이 μžˆμŠ΅λ‹ˆλ‹€ πŸ€”

ν•«ν”½μŠ€λ‘œ λ‹€μŒμ„ μˆ˜ν–‰ ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

import 'core-js/fn/array/find'

const test = ['hi', 'there'].find(item => item === 'hi')

export default () => (
  <div>{test}, welcome to next.js!</div>
)

μ—¬κΈ°μ„œ 무슨 일이 μΌμ–΄λ‚˜λŠ”μ§€ 보자.

일반 바벨 μ•±μœΌλ‘œ ν™•μΈν–ˆλŠ”λ° λ™μž‘μ€ κ°™μŠ΅λ‹ˆλ‹€.
μœ„μ—μ„œ μ–ΈκΈ‰ ν•œλŒ€λ‘œ polyfill을 μΆ”κ°€ν•΄μ•Όν•©λ‹ˆλ‹€.

κ·Έλž˜μ„œ λ‚˜λŠ” 이것이 μ •ν™•νžˆ λ‹€μŒ νŠΉμ • λ¬Έμ œκ°€ μ•„λ‹ˆκΈ° λ•Œλ¬Έμ— 이것을 λ‹«μŠ΅λ‹ˆλ‹€.

κ·ΈλŸ¬λ‚˜ λ‚˜λŠ” 더 λ§Žμ€ μ œμ•ˆμ„ μ—½λ‹ˆ λ‹€.
λ‹€μ‹œ μ—΄μ–΄ μ£Όμ‹œκΈ° λ°”λžλ‹ˆλ‹€.

@arunoda λͺ¨λ“  νŒŒμΌμ— λŒ€ν•΄ μˆ˜μ •ν•˜κΈ° μœ„ν•΄ _document.js λ‚΄λΆ€μ—μ„œ import 'core-js/fn/array/find' 둜이 ν•«ν”½μŠ€λ₯Ό μ‹œλ„ν–ˆμ§€λ§Œ IE11μ—μ„œλŠ” μž‘λ™ν•˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.

λ‹€μŒκ³Ό 같이 ν¬ν•¨ν•˜κΈ° μœ„ν•΄ μ†”λ£¨μ…˜μ„ μ‚¬μš©ν•΄μ•Όν–ˆμŠ΅λ‹ˆλ‹€.
<script src='https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.23.0/polyfill.min.js' />

Next.js V3.0.6을 μ‚¬μš©ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

이 문제λ₯Ό 더 쒋은 λ°©λ²•μœΌλ‘œ ν•΄κ²°ν•  μˆ˜μžˆλŠ” 방법이 μžˆμŠ΅λ‹ˆκΉŒ?

λͺ¨λ‘ μ•ˆλ…•.
next.config.js 의 entry-propertyλ₯Ό μ‹€ν—˜ν–ˆμŠ΅λ‹ˆλ‹€.
이것은 λ‚΄κ°€ 가진 κ²ƒμž…λ‹ˆλ‹€
(https://github.com/zeit/next.js/blob/master/server/build/webpack.js#L42에 따름) :

module.exports = {
  // eslint-disable-next-line no-unused-vars
  webpack(config, _) {
    const entry = async () => {
      const resolvedEntry = await config.entry()
      const entryWithPolyfill = Object.assign(
        { 'babel-polyfill': ['babel-polyfill'] },
        resolvedEntry
      )
      // console.log(entryWithPolyfill)
      return entryWithPolyfill
    }
    return Object.assign(
      config,
      entryWithPolyfill
    )
  }
}

μ•ˆνƒ€κΉκ²Œλ„μ΄ νŒŒμΌμ€ babel에 μ˜ν•΄ 트랜슀 파일 λ˜μ§€ μ•ŠμœΌλ―€λ‘œ 아직 μž‘λ™ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€ .

Next의 μ›ΉνŒ© ꡬ성에 babel-polyfill 을 ν¬ν•¨ν•˜λŠ” 것이 κ°€μž₯ μ’‹μŠ΅λ‹ˆλ‹€. 그것을 ν¬ν•¨ν•˜λŠ” 것은 맀우 μΌλ°˜μ μž…λ‹ˆλ‹€.

@arunoda μ–΄λ–»κ²Œ μƒκ°ν•˜μ„Έμš”?

이것에 λŒ€ν•œ μ—…λ°μ΄νŠΈκ°€ μžˆμŠ΅λ‹ˆκΉŒ? polyfill을 ν¬ν•¨ν•˜λŠ” 것은 μ΅œμ„ μ˜ 해결책이 μ•„λ‹™λ‹ˆλ‹€

이것도 관심이 πŸ€”

이 바벨 폴리 ν•„ κ°€μ Έ 였기λ₯Ό μˆ˜μ •ν–ˆμŠ΅λ‹ˆλ‹€.

import 'babel-polyfill';

babel-polyfill 전체λ₯Ό κ°€μ Έ μ˜€λŠ” 것은 맀우 λ‚­λΉ„ 적이며 next.js, imho에 λŒ€ν•œ 잘λͺ»λœ κΈ°λ³Έκ°’μž…λ‹ˆλ‹€. μ‹€μ œλ‘œ 폴리 ν•„ κΈ°λŠ₯이 ν•„μš”ν•œμ§€ 여뢀에 관계없이 λ²ˆλ“€μ— 87kbλ₯Ό μΆ”κ°€ν•©λ‹ˆλ‹€.

@sholzmayer import 'babel-polyfill'; μ–΄λ””μ„œ μ‚¬μš© ν–ˆμŠ΅λ‹ˆκΉŒ? _document.jsμ—μ„œ μ‹œλ„ν–ˆμ§€λ§Œ λ„μ›€μ΄λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.

@klaemo κ·Έλž˜μ„œ λ‹Ήμ‹ μ˜ μ œμ•ˆμ€ λ¬΄μ—‡μž…λ‹ˆκΉŒ?

transform-runtime 을 .babelrc ν”ŒλŸ¬κ·ΈμΈμ— μΆ”κ°€ν•˜λ©΄ λ‚˜μ—κ²Œ λ„μ›€μ΄λ˜λŠ” 것 κ°™μŠ΅λ‹ˆλ‹€. Object.entriesκ°€ λ‚΄μž₯λ˜μ§€ μ•Šμ€ Opera 36 용 앱을 개발 μ€‘μž…λ‹ˆλ‹€.

"plugins": [
    "transform-runtime"
]

@hugotox λŠ” μ•± κ°œλ°œμžλ‘œμ„œ https://polyfill.io λ₯Ό μ‚¬μš©ν•˜μ—¬ ν•„μš”ν•œ 폴리 ν•„ λ§Œλ‘œλ“œν•˜κ±°λ‚˜ μˆ˜λ™μœΌλ‘œ μˆ˜ν–‰ ν•  수 μžˆμŠ΅λ‹ˆλ‹€. 우리 μ•±μ—λŠ” λ‹€μŒκ³Ό 같은 polyfills.js 이 μžˆμŠ΅λ‹ˆλ‹€.

// Language features presented by https://github.com/zloirock/core-js
import 'core-js/fn/object/assign'
import 'core-js/fn/string/ends-with'
import 'core-js/fn/string/starts-with'
import 'core-js/fn/string/includes'
import 'core-js/fn/array/includes'
import 'core-js/fn/weak-map'

// browser features
import 'raf/polyfill'
import 'isomorphic-fetch'
import 'js-polyfills/url'

λ˜λŠ” nextjsλŠ” core-js μ—μ„œ ν•„μš”ν•œ λͺ¨λ“  polyfill을 가져와 λ²ˆλ“€λ‘œ 제곡 ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

@igimanaloto 이 μ†”λ£¨μ…˜μ΄ μ €μ—κ²Œ

λ‚˜λŠ” λ˜ν•œ transform-runtime ν”ŒλŸ¬κ·ΈμΈμ„ μ‚¬μš©ν•˜μ§€λ§Œ μ–΄λ–€ 이유둜 IEμ—μ„œ 였λ₯˜κ°€ λ°œμƒν•©λ‹ˆλ‹€.

{
  "plugins": [
    "source-map-support",
    "transform-runtime"
  ],
  "presets": [
    ["env", {
      "targets": {
        "node": "6.10"
      }
    }],
    ["stage-3"],
    [
      "next/babel",
      {
        "styled-jsx": {
          "optimizeForSpeed": true,
          "vendorPrefixes": true,
          "sourceMaps": true,
          "plugins": [
            "styled-jsx-plugin-sass"
          ]
        }
      }
    ]
  ]
}

@bliitzkrieg 음주 κ°€μ Έμ˜¬ 수 μ—†μŠ΅λ‹ˆλ‹€ babel-polyfill μ—μ„œ _document.js , λ•Œλ¬Έμ— _document.js μ„œλ²„μ—μ„œλ§Œ λ Œλ”λ§λ©λ‹ˆλ‹€.

일반적으둜 λ ˆμ΄μ•„μ›ƒμ— ν¬ν•¨ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€. 기본적으둜 λͺ¨λ“  νŽ˜μ΄μ§€μ—μ„œλ‘œλ“œλ˜λŠ” λͺ¨λ“  파일이 μ •μƒμ μœΌλ‘œ μž‘λ™ν•©λ‹ˆλ‹€.

μ—…λ°μ΄νŠΈ : IE 10, 11 core-js/library/fn/object/assign 에 의쑴 client/polyfill.js 둜 core-js/fn/object/assign (@klaemo 있던 μ–΄λ–»κ²Œ 그것을-λ§μ•˜μŠ΅λ‹ˆλ‹€!)


μ—¬κΈ°κ°€ Dockerized 것 next 5.1.0 μ ‘κ·Ό λ°©μ‹μ˜ 쑰합은 μœ„μ˜ @klaemo 및 곡식 μ˜ˆμ— μ˜ν•΄ ν‘œμ‹œ μ‚¬μš©μ„ μ‹œλ„, μΉ΄λ‚˜λ¦¬μ•„ / 예 /와-polyfills :

[μ›λž˜ 질문] IE11을 κ°€μ Έ μ˜€λŠ” client / polyfills.js νŒŒμΌμ—μ„œ core-js 의 μ‚¬μš©λ²•μ€ λ¬΄μ—‡μž…λ‹ˆκΉŒ? (λ‚˜λŠ” IE11이 λˆ„λ½ 된 λͺ¨λ“  것을 ν¬ν•¨ν•˜λŠ” κ°€μ Έ μ˜€κΈ°μ—μ„œ 접근을 진행 ν•œ λ‹€μŒ 점차적으둜 앱에 ν•„μš”ν•œ ν•­λͺ©μœΌλ‘œ λ²”μœ„λ₯Ό μΆ•μ†Œ ν•  κ²ƒμœΌλ‘œ μ˜ˆμƒ ν•  수 μžˆμŠ΅λ‹ˆλ‹€.)

λ‹€μŒμ€ λͺ‡ 가지 OS + λΈŒλΌμš°μ € μ‘°ν•© (λΈŒλΌμš°μ € μŠ€νƒ) μ—μ„œ κ²°κ³Ό λ₯Ό 이며 Windows 10 + IE11 (μ•„λž˜ μ°Έμ‘°) 및 기타 IE μ‘°ν•©μ—μ„œ μ‹€νŒ¨ν•©λ‹ˆλ‹€ .

screen shot 2018-04-21 at 3 49 31 pm

μ‚¬μš©μž μ •μ˜ μ„œλ²„, .babelrc 및 webpack ꡬ성을 μ‚¬μš©ν•˜μ—¬ 크둬 43μ—μ„œ next 5.1.0 을 (λ₯Ό) μ‹€ν–‰ν•˜λ €κ³ ν–ˆμŠ΅λ‹ˆλ‹€. import 'core-js/fn/object/assign'; 이 (κ°€) νŠΈλ¦­μ„ν–ˆμŠ΅λ‹ˆλ‹€.

이 버그가 μ—¬μ „νžˆ μ‘΄μž¬ν•˜λŠ” 것 κ°™μŠ΅λ‹ˆλ‹€! IE 11μ—μ„œ λ™μΌν•œ λ¬Έμ œμ— μ§λ©΄ν•˜κ³  있으며 μ–΄λ–€ μ†”λ£¨μ…˜λ„ λ„μ›€μ΄λ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. λ¬Έμ œλŠ” ν™”μ‚΄ν‘œ κΈ°λŠ₯을 μ‚¬μš©ν•˜λŠ” ansi-regex νŒ¨ν‚€μ§€λ‘œ 보이며 이것은 next.js의 μ’…μ†μ„±μž…λ‹ˆλ‹€.

@arunoda @timneutkens 이 문제λ₯Ό λ‹€μ‹œ μ—΄ 수 μžˆμŠ΅λ‹ˆκΉŒ?

μ˜ˆλŠ” μ—¬μ „νžˆ μ‘΄μž¬ν•©λ‹ˆλ‹€. 원사 해상도λ₯Ό μ‚¬μš©ν•˜μ—¬ λ‹€μš΄ κ·Έλ ˆμ΄λ“œ

import 'core-js/fn/object/assign' μ €μ—κ²Œ νš¨κ³Όμ μ΄μ—ˆμŠ΅λ‹ˆλ‹€.

core-js λ¨Όμ € μΆ”κ°€ν•΄μ•Όν–ˆμŠ΅λ‹ˆλ‹€ ( yarn add core-js )-λ¬Όλ‘ μž…λ‹ˆλ‹€.

λ‚˜λŠ” 이것이 λ„μ›€μ΄λœλ‹€λŠ” 것을 μ•Œμ•˜λ‹€ : https://github.com/aspnet/JavaScriptServices/wiki/Supporting-Internet-Explorer-11- (λ˜λŠ” -older)

λ…Έλ“œ λͺ¨λ“ˆ 용 ES6 트랜슀 νŒŒμΌμ— λŒ€ν•œ 곡식 λ¬Έμ„œλ₯Ό μΆ”κ°€ν•˜μ„Έμš”.

여기에 ν•΄κ²° 방법이 μžˆμ§€λ§Œμ΄ λ²„κ·ΈλŠ” λ‹€μ‹œ μ—΄μ–΄μ•Όν•©λ‹ˆλ‹€. 아루

ie11μ—μ„œ Object.assign, String.endsWith 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€ ([email protected])

const {basedir} = require ( './ server / config');

// 에버그린이 μ•„λ‹Œ λΈŒλΌμš°μ €μ— ν•„μš”ν•œ 폴리 ν•„ (주둜 즉)
const polyfills = [
'core-js / fn / object / assign',
'core-js / fn / string / ends-with',
'core-js / fn / string / starts-with',
'core-js / fn / string / includes',
'core-js / fn / array / includes',
'core-js / fn / weak-map',
];

module.exports = {
  webpack: (config, {dev, isServer}) => {
    const originalEntry = config.entry;
    if (!isServer) {
      config.entry = async () => {
        const entries = await originalEntry();
        Object.values(entries).forEach(entry => {
          entry.unshift(...polyfills);
          if (dev) {
            entry.unshift('eventsource-polyfill');
          }
        });
        return entries;
      };
    }

    return config;
  },
};

μ‹€μ œλ‘œ λ‚˜λŠ” λ•Œλ•Œλ‘œ μ–»λŠ”λ‹€

Cannot redefine non-configurable property 'endsWith'

이 예제 λ₯Ό 따라 polyfill을 ν¬ν•¨ν–ˆμŠ΅λ‹ˆλ‹€.
IE11이 μž‘λ™ν•˜λ €λ©΄ client/polyfills.js λ‹€μŒμ„ ν¬ν•¨ν•΄μ•Όν–ˆμŠ΅λ‹ˆλ‹€.

import 'core-js/es6/map';
import 'core-js/es6/set';

import 'core-js/fn/object/assign';
import 'core-js/fn/string/ends-with';
import 'core-js/fn/string/starts-with';
import 'core-js/fn/string/includes';
import 'core-js/fn/array/includes';
import 'core-js/fn/array/find';

import 'core-js/fn/number/is-finite';

예λ₯Ό λ“€μ–΄ isFiniteκ°€ ν•„μš”ν•œ λΌμ΄λΈŒλŸ¬λ¦¬κ°€μžˆμ„ λ•Œλ§ˆλ‹€ ν™•μ‹€ν•˜μ§€ μ•Šμ§€λ§Œ λ‚΄ 앱은 맀우 μ μŠ΅λ‹ˆλ‹€.

이것은 μž‘λ™ν•˜μ§€λ§Œ μ‹€μ œλ‘œ ν•„μš”ν•œ 폴리 필을 νŒŒμ•…ν•˜λŠ” 것은 맀우 번거 λ‘­μŠ΅λ‹ˆλ‹€.

λˆ„κ΅¬λ“ μ§€ IE11μ—μ„œ μž‘λ™ν•˜λŠ” 클래슀 ꡬ문을 μ–»κΈ° μœ„ν•΄ μ–΄λ–€ polyfill이 ν•„μš”ν•œμ§€ μ•Œκ³  μžˆμŠ΅λ‹ˆκΉŒ?

클래슀 Foo ν™•μž₯ ...

λ‹Ήμ‹ μ˜ polyfillsμ—μ„œ 'import'core-js / es6 / object ';' μ„ 

λ‚˜λŠ” 당신이 @peec 을 μ–ΈκΈ‰ ν•œ 예λ₯Ό

@peec 이 μ˜ˆμƒλ˜λŠ” λ™μž‘μž…λ‹ˆκΉŒ? 포함 된 ν•­λͺ©μ„ λ‹€μ‹œ 폴리 ν•„ν•΄μ•Όν•˜λŠ” μ΄μœ λŠ” λ¬΄μ—‡μž…λ‹ˆκΉŒ?

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰