mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-03 17:14:27 -04:00
Use src/index as browser entry point
Use src/index.js as the entry by default in tools building scratch-vm into a larger package. This saves file space by excluding extra webpack boilerplate and may allow for deeper optimizations. Depend on script dependencies for downstream webpack. For another package to build in scratch-vm's dependencies without them already being built into a consumed webpack build they need to be listed as dependencies. This can benefit large projects that reuse the same dependencies multiple times. Node will still use the main entry point and its webpack build leaves the dependencies as external references so it may reuse common modules in Node as well as in a build a browser environment.
This commit is contained in:
parent
c9842ec3dc
commit
4ceeebb257
3 changed files with 32 additions and 22 deletions
35
package.json
35
package.json
|
@ -10,7 +10,7 @@
|
|||
"url": "git+ssh://git@github.com/LLK/scratch-vm.git"
|
||||
},
|
||||
"main": "./dist/node/scratch-vm.js",
|
||||
"browser": "./dist/web/scratch-vm.js",
|
||||
"browser": "./src/index.js",
|
||||
"scripts": {
|
||||
"build": "webpack --progress --colors --bail",
|
||||
"coverage": "tap ./test/{unit,integration}/*.js --coverage --coverage-report=lcov",
|
||||
|
@ -27,6 +27,22 @@
|
|||
"watch": "webpack --progress --colors --watch",
|
||||
"version": "json -f package.json -I -e \"this.repository.sha = '$(git log -n1 --pretty=format:%H)'\""
|
||||
},
|
||||
"dependencies": {
|
||||
"arraybuffer-loader": "^1.0.3",
|
||||
"decode-html": "2.0.0",
|
||||
"diff-match-patch": "1.0.0",
|
||||
"escape-html": "1.0.3",
|
||||
"format-message": "5.2.1",
|
||||
"htmlparser2": "3.9.2",
|
||||
"immutable": "3.8.1",
|
||||
"jszip": "^3.1.5",
|
||||
"minilog": "3.1.0",
|
||||
"nets": "3.2.0",
|
||||
"scratch-parser": "4.1.1",
|
||||
"socket.io-client": "2.0.4",
|
||||
"text-encoding": "0.6.4",
|
||||
"worker-loader": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"adm-zip": "0.4.7",
|
||||
"arraybuffer-loader": "^1.0.3",
|
||||
|
@ -36,42 +52,27 @@
|
|||
"babel-preset-env": "^1.6.1",
|
||||
"canvas-toBlob": "1.0.0",
|
||||
"copy-webpack-plugin": "^4.5.1",
|
||||
"decode-html": "2.0.0",
|
||||
"diff-match-patch": "1.0.0",
|
||||
"escape-html": "1.0.3",
|
||||
"eslint": "^4.5.0",
|
||||
"eslint-config-scratch": "^5.0.0",
|
||||
"expose-loader": "0.7.5",
|
||||
"file-loader": "^1.1.6",
|
||||
"format-message": "5.2.1",
|
||||
"format-message-cli": "5.2.1",
|
||||
"gh-pages": "^1.1.0",
|
||||
"highlightjs": "^9.8.0",
|
||||
"htmlparser2": "3.9.2",
|
||||
"immutable": "3.8.1",
|
||||
"in-publish": "^2.0.0",
|
||||
"json": "^9.0.4",
|
||||
"jszip": "^3.1.5",
|
||||
"lodash.defaultsdeep": "4.6.0",
|
||||
"minilog": "3.1.0",
|
||||
"nets": "3.2.0",
|
||||
"pngjs": "^3.3.2",
|
||||
"promise": "8.0.1",
|
||||
"scratch-audio": "latest",
|
||||
"scratch-blocks": "latest",
|
||||
"scratch-parser": "4.1.1",
|
||||
"scratch-render": "latest",
|
||||
"scratch-storage": "^0.4.0",
|
||||
"scratch-translate-extension-languages": "0.0.20180521154850",
|
||||
"script-loader": "0.7.2",
|
||||
"socket.io-client": "2.0.4",
|
||||
"stats.js": "^0.17.0",
|
||||
"tap": "^11.0.1",
|
||||
"text-encoding": "0.6.4",
|
||||
"tiny-worker": "^2.1.1",
|
||||
"webpack": "^4.8.0",
|
||||
"webpack-cli": "^2.0.15",
|
||||
"webpack-dev-server": "^3.1.3",
|
||||
"worker-loader": "^1.1.1"
|
||||
"webpack-dev-server": "^3.1.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
|
||||
<div id="blocks"></div>
|
||||
|
||||
<!-- FPS counter, Syntax highlighter, Blocks, Renderer -->
|
||||
<!-- FPS counter, Blocks, Renderer -->
|
||||
<script src="./vendor.js"></script>
|
||||
<!-- Storage module -->
|
||||
<script src="./scratch-storage.js"></script>
|
||||
|
|
|
@ -69,6 +69,19 @@ module.exports = [
|
|||
output: {
|
||||
libraryTarget: 'commonjs2',
|
||||
path: path.resolve('dist', 'node')
|
||||
},
|
||||
externals: {
|
||||
'decode-html': true,
|
||||
'escape-html': true,
|
||||
'format-message': true,
|
||||
'htmlparser2': true,
|
||||
'immutable': true,
|
||||
'jszip': true,
|
||||
'minilog': true,
|
||||
'nets': true,
|
||||
'scratch-parser': true,
|
||||
'socket.io-client': true,
|
||||
'text-encoding': true
|
||||
}
|
||||
}),
|
||||
// Playground
|
||||
|
@ -79,8 +92,6 @@ module.exports = [
|
|||
'vendor': [
|
||||
// FPS counter
|
||||
'stats.js/build/stats.min.js',
|
||||
// Syntax highlighter
|
||||
'highlightjs/highlight.pack.min.js',
|
||||
// Scratch Blocks
|
||||
'scratch-blocks/dist/vertical.js',
|
||||
// Audio
|
||||
|
@ -139,8 +150,6 @@ module.exports = [
|
|||
new CopyWebpackPlugin([{
|
||||
from: 'node_modules/scratch-blocks/media',
|
||||
to: 'media'
|
||||
}, {
|
||||
from: 'node_modules/highlightjs/styles/zenburn.css'
|
||||
}, {
|
||||
from: 'node_modules/scratch-storage/dist/web'
|
||||
}, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue