Giter Club home page Giter Club logo

Comments (7)

egoist avatar egoist commented on August 29, 2024

Can you provide more details on how you change the code, or a repo.

npm i -S jquery and import $ from 'jquery' just works for me.

from vuepack.

dodas avatar dodas commented on August 29, 2024

Sorry, my bad, i had not fresh source.

What is creating this issue is module googlemaps-js-rich-marker. It is enough that this module is installed (don't have to be imported) for this issue to arise: npm i -S googlemaps-js-rich-marker

So now it is maybe not vuepack's failure. Could you guide me how to solve this? I am new to whole webpack/bundling/etc.

Thanks.

from vuepack.

egoist avatar egoist commented on August 29, 2024

Ok, seems googlemaps-js-rich-marker needs to be compiled to es5

It failed because that package is written in ES6 and uglifyjs doesn't understand ES6 syntax, and we do not compile files in node_modules folder by default.

Why it failed even if you didn't import googlemaps-js-rich-marker

Since vuepack splits all dependencies specified in package.json into a single vendor.xxx.js, googlemaps-js-rich-marker will always be compiled by webpack and bundled into vendor.xxx.js

How to fix

You should make babel-loader compile it to ES5. Checkout webpack.base.js.

By default it excludes node_modules and does not handle .es6 extension which that module uses, so the fix for you will be:

{
    test: /\.(js|es6)$/,
    loaders: ['babel'],
    // compile your app directory and some modules
    include: [/client/, /node_modules\/googlemaps-js-rich-marker/]
}

from vuepack.

dodas avatar dodas commented on August 29, 2024

Thank you for detailed explanation, now I understand.
For the loaders part, wouldn't this be sufficient? Does it have any disadvantages?

{
  test: /\.js$/,
  loaders: ['babel'],
  exclude: [/node_modules/]
},
{
  test: /\.es6$/,
  loaders: ['babel']
}

from vuepack.

egoist avatar egoist commented on August 29, 2024

Maybe yours is better. .es6 should always be compiled to ES5

from vuepack.

dodas avatar dodas commented on August 29, 2024

Great, don't you think this could be part od vuepack by default?

from vuepack.

egoist avatar egoist commented on August 29, 2024

Updated 👏

from vuepack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.