vue-bulma / modal

Modal component for Vue Bulma
MIT License
49 stars 28 forks source link

fix uglify issue Failed to compile on 'npm run production PR #17 #20

Closed johnjjung closed 6 years ago

johnjjung commented 7 years ago

This fixes an uglify issue when you use this library and build for production

luventa commented 7 years ago

I think instead of Adding this section of codes into your webpack config may prevent your issue.

{
  test: /\.js$/,
  loader: 'babel-loader',
  include: YOURPROJECTPATH,
  exclude: [new RegExp(`node_modules\\${path.sep}(?!vue-bulma-.*)`)]
}

Now babel loader will pre-compile vue-bulma components inside node_modules

yegor-usoltsev commented 7 years ago

@luventa as for me, your solution isn't looks good.

@fundon, @netpi, could you please merge this pull request?

Currently I'm getting the following error: ERROR in static/js/vendor.b65923b5a62023bbf6da.js from UglifyJs Unexpected token punc «(», expected punc «:» [./~/vue-bulma-modal/src/BaseModal.js:14,0][static/js/vendor.b65923b5a62023bbf6da.js:1706,7] This error prevents vendor.js from beeing minified by UglifyJs because BaseModal.js is written in ES6 style. But UglifyJs currently doesn't support ES6.

mcknight0219 commented 7 years ago

@meMo-Minsk You should use babel to transpile first if you are using Webpack

chimit commented 7 years ago

Have the same issue:

ERROR in static/js/vendor.a30779b5f94018af5881.js from UglifyJs
Unexpected token: punc (() [./~/vue-bulma-modal/src/BaseModal.js:14,0][static/js/vendor.a30779b5f94018af5881.js:5007,7]

But @johnjjung's fix doesn't work too:

ERROR in ./~/vue-bulma-modal/src/BaseModal.js
Module parse failed: /Users/user/project/node_modules/vue-bulma-modal/src/BaseModal.js Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| <script>
| export default {
| 
 @ ./~/vue-bulma-modal/src/index.js 2:0-35
 @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/components/Products/ThingView.vue
 @ ./src/components/Products/ThingView.vue
 @ ./src/modules/routes.js
 @ ./src/main.js
chimit commented 7 years ago

@luventa

exclude: [new RegExp(`node_modules\\${path.sep}(?!vue-bulma-.*)`)]

doesn't work too.