Skip to content
This repository has been archived by the owner on Jan 29, 2019. It is now read-only.

Commit

Permalink
fix(build): fixing esm build + commonjs build
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsasharegan committed Sep 18, 2017
1 parent b202be7 commit 73a53a6
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 19 deletions.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/vue-transmit.common.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/vue-transmit.js → dist/vue-transmit.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/vue-transmit.esm.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions dist/vue-transmit.esm.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/vue-transmit.esm.min.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/vue-transmit.js.map

This file was deleted.

1 change: 0 additions & 1 deletion dist/vue-transmit.min.js.map

This file was deleted.

16 changes: 6 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@
"name": "vue-transmit",
"version": "5.1.2",
"description": "Vue.js drag & drop uploader based on Dropzone.js",
"module": "index.js",
"jsnext:main": "index.js",
"module": "dist/vue-transmit.esm.min.js",
"jsnext:main": "dist/vue-transmit.esm.min.js",
"main": "dist/vue-transmit.min.js",
"keywords": [
"dragndrop",
"drag and drop",
"file upload",
"upload"
],
"keywords": ["dragndrop", "drag and drop", "file upload", "upload"],
"directories": {
"test": "test"
},
"scripts": {
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules",
"dev": "cross-env NODE_ENV=development webpack --progress --hide-modules -w",
"clean": "scripts/clean.js",
"build": "npm run clean && cross-env NODE_ENV=production webpack --progress --hide-modules",
"dev": "npm run clean && cross-env NODE_ENV=development webpack --progress --hide-modules -w",
"test": "php -S localhost:3000 -t ./test/",
"lib-size": "gzip -c dist/vue-transmit.min.js | wc -c",
"release": "standard-version",
Expand Down
17 changes: 17 additions & 0 deletions scripts/clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env node
const { promisify } = require("util")
const { resolve } = require("path")
const fs = require("fs")
const [unlink, readdir] = [fs.unlink, fs.readdir].map(promisify)

async function main() {
try {
const jsDir = resolve(__dirname, "../dist")
const entries = await readdir(jsDir)
await Promise.all(entries.map(entry => unlink(resolve(jsDir, entry))))
} catch (err) {
console.error(err)
}
}

main()
25 changes: 21 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,27 @@ function config(ctx) {

module.exports = [
config({
ext: "min",
ext: "esm",
noMinify: true,
output: {
libraryTarget: "commonjs2"
},
rules: [
{
test: /\.js$/,
include: [SRC, LODASH],
loader: "babel-loader",
options: {
plugins: BABEL_PLUGINS
}
}
]
}),
config({
ext: "esm.min",
showBundleAnalysis: false,
output: {
libraryTarget: "commonjs2",
libraryExport: "default"
libraryTarget: "commonjs2"
},
rules: [
{
Expand All @@ -140,7 +156,8 @@ module.exports = [
]
}),
config({
noMinify: true,
ext: "common.min",
showBundleAnalysis: false,
output: {
libraryTarget: "commonjs2",
libraryExport: "default"
Expand Down

0 comments on commit 73a53a6

Please sign in to comment.