Skip to content

when i npm run dev i find in ios safari and not can open my project #1511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 2 tasks
roy201603 opened this issue Sep 27, 2018 · 5 comments
Closed
1 of 2 tasks

when i npm run dev i find in ios safari and not can open my project #1511

roy201603 opened this issue Sep 27, 2018 · 5 comments

Comments

@roy201603
Copy link

roy201603 commented Sep 27, 2018

  • Operating System:IOS
  • Node Version:8.11.4
  • NPM Version:5.6.0
  • webpack Version:3.6.0
  • webpack-dev-server Version:2.7.1
  • This is a bug
    when i npm run dev i find in ios safari and not can open my project
    and also find
    SyntaxError: Unexpected keyword 'const'. Const declarations are not supported in strict mode.
    /app.js:57856:0
    and i search when webpack-dev-server version up 2.7.1 some people have report this problem
    so i install webpack-dev-server version is 2.7.1 but no use so i need how to slove this problem
    but in iphone mobile it will can open but in PC it is not use

  • This is a modification request

Code

  // webpack.config.js
  // additional code, remove if not needed.

Expected Behavior

Actual Behavior

For Bugs; How can we reproduce the behavior?

For Features; What is the motivation and/or use-case for the feature?

@roy201603
Copy link
Author

image

@michael-ciniawsky
Copy link
Member

It seems when you bundle your application a tool like e.g babel (babel-loader) adds a 'use strict'; pragma to the bundle file and depending on the browser (e.g without decent ES2015 (ES6) support) you're using this might leads to the current {Error} you're experiencing. Try to remove the pragma from the app.js file and check if this fixes your {Error}, then checkout how to disable that behavior. I'm closing this issue since it's likely unrelated to webpack-dev-server in particular, but feel free to reopen if more information is provided why this maybe related

@michael-ciniawsky
Copy link
Member

#1270

Updated to at least webpack-dev-server >= v2.11.0

@roy201603
Copy link
Author

image
i have install webpack-dev-server to 2.11.3 and not use babel-loader strict mode so you think this is babel bring this problem?

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Sep 27, 2018

Either webpack or babel (babel-loader) add a 'use strict' pragma (I think it is babel). e.g

file.js

const a = 42

file.transpiled.js

'use strict'; // <= added by babel

var a = 42;

yet you exlude the node_modules folder and one of your dependencies might use ES6 Syntax which doesn't get transpiled atm eventually leading to e.g

file.js

import dep from 'pkg'

const a = 42

file.transpiled.js

'use strict'; // <= added by babel

// import dep from 'pkg' (not transpiled)
const dep = true // <= {Error}

var a = 42;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants