mirror of
https://github.com/KevinMidboe/vue-js-modal.git
synced 2025-10-29 18:00:20 +00:00
This allow the bundle to be used in jsfiddle, plnkr, jsbin, etc.,
as the bundle does not depend on Vue.
The problem lies on second line of bundle
```js
"object" == typeof exports ? exports["vue-js-modal"] = factory(require("vue")) : root["vue-js-modal"] = factory(root.vue)
```
where `factory` tries to find `root.vue`, but the official Vue bundle exports
as `root.Vue`.
Removing the runtime dependency solves this.
`Object.assign` is available in all browsers but IE:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
36 lines
796 B
JavaScript
36 lines
796 B
JavaScript
const path = require('path')
|
|
const webpack = require('webpack')
|
|
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
|
|
|
// "build:client": "cross-env NODE_ENV=production webpack --config ./build/webpack.client.config.js --progress --hide-modules",
|
|
|
|
module.exports = {
|
|
entry: path.resolve(__dirname, '../src/index.js'),
|
|
output: {
|
|
path: path.resolve(__dirname, '../dist'),
|
|
publicPath: '/dist/',
|
|
library:'vue-js-modal',
|
|
libraryTarget: 'umd'
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.vue$/,
|
|
loader: 'vue-loader'
|
|
},
|
|
{
|
|
test: /\.js$/,
|
|
loader: 'babel-loader',
|
|
exclude: /node_modules/
|
|
}
|
|
]
|
|
},
|
|
devtool: '#source-map',
|
|
plugins: [
|
|
new UglifyJSPlugin({
|
|
mangle: false,
|
|
beautify: true
|
|
})
|
|
]
|
|
}
|