mirror of
https://github.com/scratchfoundation/scratch-render.git
synced 2025-08-28 22:30:04 -04:00
Update packaging to use UMD and the browser field
The web build is now packaged as UMD, and the `browser` field in `package.json` now points to the web build output.
This commit is contained in:
parent
d7c7a56e25
commit
63fc1c6f64
3 changed files with 10 additions and 14 deletions
|
@ -10,6 +10,7 @@
|
|||
"url": "git+ssh://git@github.com/LLK/scratch-render.git"
|
||||
},
|
||||
"main": "./dist/node/scratch-render.js",
|
||||
"browser": "./dist/web/scratch-render.js",
|
||||
"scripts": {
|
||||
"build": "webpack --progress --colors",
|
||||
"docs": "jsdoc -c .jsdoc.json",
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
/* eslint-env browser */
|
||||
require('babel-polyfill');
|
||||
|
||||
/**
|
||||
* Export for use in a web page.
|
||||
* @type {RenderWebGL}
|
||||
*/
|
||||
window.RenderWebGL = require('./index');
|
|
@ -13,7 +13,7 @@ const base = {
|
|||
rules: [
|
||||
{
|
||||
include: [
|
||||
path.resolve(__dirname, 'src')
|
||||
path.resolve('src')
|
||||
],
|
||||
test: /\.js$/,
|
||||
loader: 'babel-loader',
|
||||
|
@ -43,7 +43,8 @@ module.exports = [
|
|||
'scratch-render': './src/index-web.js'
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'playground'),
|
||||
library: 'ScratchRender',
|
||||
path: path.resolve('playground'),
|
||||
filename: '[name].js'
|
||||
},
|
||||
plugins: base.plugins.concat([
|
||||
|
@ -58,11 +59,13 @@ module.exports = [
|
|||
Object.assign({}, base, {
|
||||
target: 'web',
|
||||
entry: {
|
||||
'scratch-render': './src/index-web.js',
|
||||
'scratch-render.min': './src/index-web.js'
|
||||
'scratch-render': './src/index.js',
|
||||
'scratch-render.min': './src/index.js'
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist/web'),
|
||||
library: 'ScratchRender',
|
||||
libraryTarget: 'umd',
|
||||
path: path.resolve('dist', 'web'),
|
||||
filename: '[name].js'
|
||||
}
|
||||
}),
|
||||
|
@ -75,7 +78,7 @@ module.exports = [
|
|||
output: {
|
||||
library: 'ScratchRender',
|
||||
libraryTarget: 'commonjs2',
|
||||
path: path.resolve(__dirname, 'dist/node'),
|
||||
path: path.resolve('dist', 'node'),
|
||||
filename: '[name].js'
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue