undefinedfix
Sign in

Ie11 report script5009: "promise" is not defined after Vue project is packaged

bakapasanac edited in Mon, 01 Nov 2021

The development environment is normal, and Babel Polyfill is not configured in the development environment. That is to say, ie11 can open the page in the development environment (if the development environment is not configured with Babel Polyfill, it can also be opened with ie11). But after packaging and deployment, it won't work-_ -。

For this reason, Babel plyfill is added, but it doesn't solve the problem...

package.json :

{
  "name": "edongmi-app",
  "version": "2.1.1",
  "description": "edongmi saas system",
  "author": "www.simubb.com",
  "private": true,
  "scripts": {
    "dev": "node build/dev-server.js",
    "start": "node build/dev-server.js",
    "build": "node build/build.js",
    "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
    "e2e": "node test/e2e/runner.js",
    "test": "npm run unit && npm run e2e",
    "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs"
  },
  "dependencies": {
    "axios": "^0.16.2",
    "babel-polyfill": "^6.26.0",
    "chart.js": "2.5.0",
    "element-theme-default": "^1.4.12",
    "element-ui": "^2.0.10",
    "es6-promise": "^4.2.2",
    "vue-chartjs": "2.6.3",
    "vue-router": "2.5.3",
    "vue-strap": "github:wffranco/vue-strap",
    "vue-template-compiler": "^2.5.3",
    "vuex": "^2.3.1"
  },
  "devDependencies": {
    "autoprefixer": "7.1.1",
    "babel-core": "6.24.1",
    "babel-eslint": "7.2.3",
    "babel-loader": "7.0.0",
    "babel-plugin-istanbul": "4.1.3",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-preset-env": "1.5.1",
    "babel-preset-stage-2": "6.24.1",
    "babel-register": "6.24.1",
    "chai": "^3.5.0",
    "chalk": "^1.1.3",
    "chromedriver": "^2.29.0",
    "connect-history-api-fallback": "^1.3.0",
    "copy-webpack-plugin": "^4.0.1",
    "cross-env": "5.0.0",
    "cross-spawn": "^5.0.1",
    "css-loader": "0.28.2",
    "eslint": "3.19.0",
    "eslint-config-standard": "10.2.1",
    "eslint-friendly-formatter": "3.0.0",
    "eslint-loader": "1.7.1",
    "eslint-plugin-html": "2.0.3",
    "eslint-plugin-import": "2.2.0",
    "eslint-plugin-node": "4.2.2",
    "eslint-plugin-promise": "3.5.0",
    "eslint-plugin-standard": "3.0.1",
    "eventsource-polyfill": "^0.9.6",
    "express": "4.15.3",
    "extract-text-webpack-plugin": "2.1.0",
    "file-loader": "0.11.1",
    "friendly-errors-webpack-plugin": "1.6.1",
    "html-webpack-plugin": "^2.28.0",
    "http-proxy-middleware": "0.17.4",
    "inject-loader": "3.0.0",
    "karma": "1.7.0",
    "karma-coverage": "^1.1.1",
    "karma-mocha": "^1.3.0",
    "karma-phantomjs-launcher": "1.0.4",
    "karma-phantomjs-shim": "^1.4.0",
    "karma-sinon-chai": "1.3.1",
    "karma-sourcemap-loader": "^0.3.7",
    "karma-spec-reporter": "0.0.31",
    "karma-webpack": "2.0.3",
    "lolex": "^1.5.2",
    "mocha": "3.4.1",
    "nightwatch": "0.9.15",
    "opn": "5.0.0",
    "optimize-css-assets-webpack-plugin": "1.3.2",
    "ora": "1.2.0",
    "phantomjs-prebuilt": "^2.1.14",
    "rimraf": "^2.6.0",
    "selenium-server": "3.4.0",
    "semver": "^5.3.0",
    "shelljs": "^0.7.6",
    "sinon": "2.3.1",
    "sinon-chai": "2.10.0",
    "url-loader": "^0.5.7",
    "vue-loader": "12.1.0",
    "vue-style-loader": "3.0.1",
    "webpack": "2.6.0",
    "webpack-bundle-analyzer": "2.8.2",
    "webpack-dev-middleware": "1.10.2",
    "webpack-hot-middleware": "2.18.0",
    "webpack-merge": "4.1.0"
  },
  "engines": {
    "node": ">= 4.0.0",
    "npm": ">= 3.0.0"
  }
}

main.js The first line introduces

import 'babel-polyfill'
4 Replies
Drasar
commented on Mon, 01 Nov 2021

Add Babel Polyfill in the webpack entry file

fnzv
commented on Mon, 01 Nov 2021

entry: {

app: "./src/main.js"

}Change to entry:{

app: ["babel-polyfill", "./src/main.js"]

}Don't import

bcfdk
commented on Mon, 01 Nov 2021

Sure enough, just get rid of the main

openHBP
commented on Tue, 02 Nov 2021

I use react. I only need to operate two steps. One is to add "Babel Polyfill" in dependencies: "^ 6.26.0"; the other is to add the same module name after each imported module: ["Babel Polyfill",'js']

lock This question has been locked and the reply function has been disabled.