vue-dropzone icon indicating copy to clipboard operation
vue-dropzone copied to clipboard

Error in ie 11 SCRIPT1003: Expected ':'

Open czbas23 opened this issue 6 years ago • 26 comments

czbas23 avatar Apr 03 '19 08:04 czbas23

Hi @rowanwins, I have the same issue in IE11 with [email protected]

image

image

RomanNalapko avatar Apr 03 '19 09:04 RomanNalapko

Hi @czbas23 & @RomanNalapko

You should be able to find some suggestions to support IE11 in this issue https://github.com/rowanwins/vue-dropzone/issues/437

Regards, Rowan

rowanwins avatar Apr 03 '19 10:04 rowanwins

I use Laravel not has file vue.config.js. I use .babelrc, how can I fix the problem?

czbas23 avatar Apr 03 '19 11:04 czbas23

@rowanwins Thanks for advice, but I'm not using vue-cli. I'm using webpack, ts-loader with target ES5

RomanNalapko avatar Apr 03 '19 14:04 RomanNalapko

Can you try npm install @babel/polyfill --save and then somewhere in your project do import '@babel/polyfill'

rowanwins avatar Apr 03 '19 22:04 rowanwins

babel/polyfill does not help

RomanNalapko avatar Apr 04 '19 16:04 RomanNalapko

I have to downgrade to 3.5.1 for it to work. I understands why @rowanwins not supporting this due IE being obsolete browser, but poor souls like us still need to support IE due to company policy.

-- EDIT -- This is not a critisim to @rowanwins ... just explaining why some people insists on IE support... I am deeply thankful for this hard work.

rosdi avatar Apr 11 '19 09:04 rosdi

All good @rosdi :)

I understand that it would be good for it to work, we just need to find a repeatable way for people to do it..

rowanwins avatar Apr 11 '19 11:04 rowanwins

I believe I have a fix for this. Here's my config using Webpack 4 and Babel 7. You'll have to adjust for earlier versions of either.

babel.config.js

module.exports = {
	presets: ["@babel/preset-env"],
	overrides: [
		{
			test: ["./node_modules/vue2-dropzone"],
			presets: [
				["@babel/preset-env", {	targets: { ie: "11" } }],
			],
		}],
};

Inside module:rules: in webpack.config.js

{
	test: /\.js$/,
	exclude: file => (
		/node_modules/.test(file) &&
		!/vue2-dropzone/.test(file)
	),
	use: [
		{ loader: "babel-loader" },
	],
},

jsodeman avatar Apr 17 '19 15:04 jsodeman

Thanks for sharing @jsodeman

rowanwins avatar Apr 21 '19 08:04 rowanwins

First off thanks @rowanwins this is a great wrapper for dropzone, so much nicer to use in our Vue app.

Like @rosdi I've also had to drop back to 3.5.1 to ensure everything works on IE. This isn't really a problem for us but I am just wandering if IE compatibility is on the road map for future releases?

thatdoorsajar avatar May 02 '19 11:05 thatdoorsajar

Same problem here, would be nice to get a fix for this in the new version.

lenvanessen avatar May 03 '19 08:05 lenvanessen

Hi @thatdoorsajar & @lenvanessen

A fix would indeed be great. Unfortunately I'm now operating on a mac and so IE11 testing is a bit trickier. I'm open to a PR if someone can identify a resolution.

rowanwins avatar May 05 '19 23:05 rowanwins

This is because dist/vue2Dropzone.js has es6 code not transpiled into es5 supported by IE11.

alexey-v-paramonov avatar May 31 '19 15:05 alexey-v-paramonov

Having the same issue as @RomanNalapko with the version 3.5.9. Tested through BrowserStack. Capture d’écran 2019-06-05 à 16 40 10

WilliamDASILVA avatar Jun 05 '19 14:06 WilliamDASILVA

+1 to fix this, thank you very much for your awesome dropzone wrapper!

exhtml avatar Jun 07 '19 12:06 exhtml

+1. Build into es5 should fix the problem.

arkhamvm avatar Jun 17 '19 01:06 arkhamvm

have the same issue in IE 11 with react-babel app

dementiev avatar Jun 27 '19 11:06 dementiev

Rolling back to 3.5.1 worked for me

Paul-Cl-ark avatar Aug 15 '19 13:08 Paul-Cl-ark

I believe I have a fix for this. Here's my config using Webpack 4 and Babel 7. You'll have to adjust for earlier versions of either.

babel.config.js

module.exports = {
	presets: ["@babel/preset-env"],
	overrides: [
		{
			test: ["./node_modules/vue2-dropzone"],
			presets: [
				["@babel/preset-env", {	targets: { ie: "11" } }],
			],
		}],
};

Inside module:rules: in webpack.config.js

{
	test: /\.js$/,
	exclude: file => (
		/node_modules/.test(file) &&
		!/vue2-dropzone/.test(file)
	),
	use: [
		{ loader: "babel-loader" },
	],
},

@jsodeman's solution indeed fixed the untranspilled code and it is working in ie 11

FerraBraiZ avatar Sep 18 '19 12:09 FerraBraiZ

Nuxt also same issue , tried to build: { transpile: ['vue2-dropzone'] } but this leads to Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option.Please provide any workaround? Thanks

sudhakarselva avatar Mar 09 '20 13:03 sudhakarselva

Nuxt also same issue , tried to build: { transpile: ['vue2-dropzone'] } but this leads to Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option.Please provide any workaround? Thanks

I've had to do this: in vue.config.js:

transpileDependencies: ['vue2-dropzone']

As you can see above, initially rolling back worked, until it didn't...

Paul-Cl-ark avatar Mar 09 '20 13:03 Paul-Cl-ark

@Paul-Cl-ark , after adding in transpile dep .component stopped working for me. Failed to mount component: template or render function not defined.

sudhakarselva avatar Mar 09 '20 13:03 sudhakarselva

How are you registering it?

<template>
<VueDropzone />
</template>
<script>
import VueDropzone from 'vue2-dropzone'
export default {
  name: 'UploadBox',
  components: { VueDropzone }
}
</script>

Paul-Cl-ark avatar Mar 09 '20 14:03 Paul-Cl-ark

@Paul-Cl-ark .same way only . i tried adding in transpile for babel but i think problem is because we are using code from dist whiich is already built using some babel config .inorder to fix this issue i raised pull request for exposing src folder which is transpiled by my build config so it resolved this issue.I hope it get merged. i think exposing src folder is mandatory so that user can use their build pipeline

Please refer:- https://github.com/rowanwins/vue-dropzone/pull/534

Useful link:- Thorsten Lünborg - Vue CLI – How to write components with it( https://www.youtube.com/watch?v=WH_zrZpMtCE ) Use patch package, if u cant wait for pull request merge. https://www.npmjs.com/package/patch-package

sudhakarselva avatar Mar 12 '20 11:03 sudhakarselva

it's worked for me. Thank you

cys2best avatar Mar 09 '22 10:03 cys2best