Skip to content

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

Description

@roy201603
  • 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?

Activity

  1. roy201603 commented on Sep 27, 2018

    @roy201603
    Author

    image

  2. michael-ciniawsky commented on Sep 27, 2018

    @michael-ciniawsky
    Contributor

    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

  3. michael-ciniawsky commented on Sep 27, 2018

    @michael-ciniawsky
    Contributor

    #1270

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

  4. roy201603 commented on Sep 27, 2018

    @roy201603
    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?

  5. michael-ciniawsky commented on Sep 27, 2018

    @michael-ciniawsky
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions