From b7e7d6d9b9fdac69aa857a5d26e13bbf0021cf62 Mon Sep 17 00:00:00 2001 From: "Michael \"Z\" Goddard" <mzgoddard@gmail.com> Date: Mon, 30 Apr 2018 14:35:31 -0400 Subject: [PATCH] chore(package): expose src/index as browser entry point Downstream webpack will need any dependencies src/ depends on so it can successfully build. Also if multiple packages being built into a larger script share a common dependency version range, they can share the dependency instead of duplicating it. This will save built file size, execution time, and memory. --- package.json | 17 +++++++++-------- webpack.config.js | 7 +++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 9c73f300..37d37900 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "url": "https://github.com/LLK/scratch-storage.git" }, "main": "./dist/node/scratch-storage.js", - "browser": "./dist/web/scratch-storage.js", + "browser": "./src/index.js", "scripts": { "build": "webpack --progress --colors --bail", "coverage": "tap ./test/{unit,integration}/*.js --coverage --coverage-report=lcov", @@ -23,31 +23,32 @@ "watch": "webpack --progress --colors --watch", "semantic-release": "semantic-release pre && npm publish && semantic-release post" }, + "dependencies": { + "arraybuffer-loader": "^1.0.3", + "base64-js": "1.2.1", + "js-md5": "0.6.1", + "localforage": "1.5.0", + "nets": "3.2.0", + "text-encoding": "0.6.4" + }, "devDependencies": { "@commitlint/cli": "6.1.0", "@commitlint/config-conventional": "6.1.0", "@commitlint/travis-cli": "6.1.0", - "arraybuffer-loader": "^1.0.3", "babel-core": "6.22.1", "babel-eslint": "7.1.1", "babel-loader": "^7.1.4", "babel-polyfill": "6.22.0", "babel-preset-env": "^1.6.1", - "base64-js": "1.2.1", "cz-conventional-changelog": "^2.0.0", - "debug": "2.6.0", "eslint": "3.14.1", "eslint-config-scratch": "3.1.0", "eslint-plugin-react": "6.9.0", "file-loader": "1.1.11", "husky": "0.14.3", - "js-md5": "0.6.1", "json": "^9.0.4", - "localforage": "1.5.0", - "nets": "3.2.0", "semantic-release": "^6.3.2", "tap": "8.0.1", - "text-encoding": "0.6.4", "travis-after-all": "^1.4.4", "uglifyjs-webpack-plugin": "^1.2.5", "webpack": "^4.8.0", diff --git a/webpack.config.js b/webpack.config.js index 1add8622..4fe7a9e3 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -56,6 +56,13 @@ module.exports = [ libraryTarget: 'commonjs2', path: path.resolve('dist', 'node'), filename: '[name].js' + }, + externals: { + 'base64-js': true, + 'js-md5': true, + 'localforage': true, + 'nets': true, + 'text-encoding': true } }) ];