mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 21:53:59 +00:00
Updated configs
This commit is contained in:
parent
7ca0edcdfc
commit
769f40e117
6 changed files with 200 additions and 8 deletions
|
@ -27,11 +27,11 @@
|
|||
"plugin.cam3d": "webpack --config plugins/camera3d/webpack.config.js",
|
||||
"plugin.spine": "webpack --config plugins/spine/webpack.config.js",
|
||||
"plugin.spine.dist": "webpack --config plugins/spine/webpack.auto.dist.config.js",
|
||||
"plugin.spine.watch": "webpack --config plugins/spine/webpack.auto.config.js --watch",
|
||||
"plugin.spine.watch": "webpack --config plugins/spine/webpack.auto.config.js --watch --display-modules",
|
||||
"plugin.spine.canvas.dist": "webpack --config plugins/spine/webpack.canvas.dist.config.js",
|
||||
"plugin.spine.canvas.watch": "webpack --config plugins/spine/webpack.canvas.config.js --watch",
|
||||
"plugin.spine.canvas.watch": "webpack --config plugins/spine/webpack.canvas.config.js --watch --display-modules",
|
||||
"plugin.spine.webgl.dist": "webpack --config plugins/spine/webpack.webgl.dist.config.js",
|
||||
"plugin.spine.webgl.watch": "webpack --config plugins/spine/webpack.webgl.config.js --watch",
|
||||
"plugin.spine.webgl.watch": "webpack --config plugins/spine/webpack.webgl.config.js --watch --display-modules",
|
||||
"lint": "eslint --config .eslintrc.json \"src/**/*.js\"",
|
||||
"lintfix": "eslint --config .eslintrc.json \"src/**/*.js\" --fix",
|
||||
"sloc": "node-sloc \"./src\" --include-extensions \"js\"",
|
||||
|
|
|
@ -11,8 +11,8 @@ module.exports = {
|
|||
context: `${__dirname}/src/`,
|
||||
|
||||
entry: {
|
||||
'SpinePlugin': './SpinePlugin.js',
|
||||
'SpinePlugin.min': './SpinePlugin.js'
|
||||
'SpinePlugin': './SpineWebGLPlugin.js',
|
||||
'SpinePlugin.min': './SpineWebGLPlugin.js'
|
||||
},
|
||||
|
||||
output: {
|
||||
|
@ -52,7 +52,7 @@ module.exports = {
|
|||
resolve: {
|
||||
alias: {
|
||||
'SpineCanvas': './runtimes/spine-canvas.js',
|
||||
'SpineGL': './runtimes/spine-webgl.js'
|
||||
'SpineWebGL': './runtimes/spine-webgl.js'
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -75,6 +75,10 @@ module.exports = {
|
|||
},
|
||||
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
"typeof CANVAS_RENDERER": JSON.stringify(true),
|
||||
"typeof WEBGL_RENDERER": JSON.stringify(true)
|
||||
}),
|
||||
new CleanWebpackPlugin([ 'dist' ]),
|
||||
{
|
||||
apply: (compiler) => {
|
|
@ -50,7 +50,7 @@ module.exports = {
|
|||
resolve: {
|
||||
alias: {
|
||||
'SpineCanvas': './runtimes/spine-canvas.js',
|
||||
'SpineGL': './runtimes/spine-webgl.js'
|
||||
'SpineWebGL': './runtimes/spine-webgl.js'
|
||||
},
|
||||
},
|
||||
|
||||
|
|
94
plugins/spine/webpack.canvas.dist.config.js
Normal file
94
plugins/spine/webpack.canvas.dist.config.js
Normal file
|
@ -0,0 +1,94 @@
|
|||
'use strict';
|
||||
|
||||
const webpack = require('webpack');
|
||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
||||
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
||||
const exec = require('child_process').exec;
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
|
||||
context: `${__dirname}/src/`,
|
||||
|
||||
entry: {
|
||||
'SpineCanvasPlugin': './SpineCanvasPlugin.js',
|
||||
'SpineCanvasPlugin.min': './SpineCanvasPlugin.js'
|
||||
},
|
||||
|
||||
output: {
|
||||
path: `${__dirname}/dist/`,
|
||||
filename: '[name].js',
|
||||
library: 'SpineCanvasPlugin',
|
||||
libraryTarget: 'umd',
|
||||
sourceMapFilename: '[file].map',
|
||||
devtoolModuleFilenameTemplate: 'webpack:///[resource-path]', // string
|
||||
devtoolFallbackModuleFilenameTemplate: 'webpack:///[resource-path]?[hash]', // string
|
||||
umdNamedDefine: true
|
||||
},
|
||||
|
||||
performance: { hints: false },
|
||||
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: require.resolve('./src/runtimes/spine-canvas.js'),
|
||||
use: 'imports-loader?this=>window'
|
||||
},
|
||||
{
|
||||
test: require.resolve('./src/runtimes/spine-canvas.js'),
|
||||
use: 'exports-loader?spine'
|
||||
},
|
||||
{
|
||||
test: require.resolve('./src/runtimes/spine-webgl.js'),
|
||||
use: 'imports-loader?this=>window'
|
||||
},
|
||||
{
|
||||
test: require.resolve('./src/runtimes/spine-webgl.js'),
|
||||
use: 'exports-loader?spine'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
resolve: {
|
||||
alias: {
|
||||
'SpineCanvas': './runtimes/spine-canvas.js',
|
||||
'SpineWebGL': './runtimes/spine-webgl.js'
|
||||
},
|
||||
},
|
||||
|
||||
optimization: {
|
||||
minimizer: [
|
||||
new UglifyJSPlugin({
|
||||
include: /\.min\.js$/,
|
||||
parallel: true,
|
||||
sourceMap: false,
|
||||
uglifyOptions: {
|
||||
compress: true,
|
||||
ie8: false,
|
||||
ecma: 5,
|
||||
output: {comments: false},
|
||||
warnings: false
|
||||
},
|
||||
warningsFilter: () => false
|
||||
})
|
||||
]
|
||||
},
|
||||
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
"typeof CANVAS_RENDERER": JSON.stringify(true),
|
||||
"typeof WEBGL_RENDERER": JSON.stringify(false)
|
||||
}),
|
||||
new CleanWebpackPlugin([ 'dist' ]),
|
||||
{
|
||||
apply: (compiler) => {
|
||||
compiler.hooks.afterEmit.tap('AfterEmitPlugin', (compilation) => {
|
||||
exec('node plugins/spine/copy-to-examples.js', (err, stdout, stderr) => {
|
||||
if (stdout) process.stdout.write(stdout);
|
||||
if (stderr) process.stderr.write(stderr);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
|
@ -50,7 +50,7 @@ module.exports = {
|
|||
resolve: {
|
||||
alias: {
|
||||
'SpineCanvas': './runtimes/spine-canvas.js',
|
||||
'SpineGL': './runtimes/spine-webgl.js'
|
||||
'SpineWebGL': './runtimes/spine-webgl.js'
|
||||
},
|
||||
},
|
||||
|
||||
|
|
94
plugins/spine/webpack.webgl.dist.config.js
Normal file
94
plugins/spine/webpack.webgl.dist.config.js
Normal file
|
@ -0,0 +1,94 @@
|
|||
'use strict';
|
||||
|
||||
const webpack = require('webpack');
|
||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
||||
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
||||
const exec = require('child_process').exec;
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
|
||||
context: `${__dirname}/src/`,
|
||||
|
||||
entry: {
|
||||
'SpineWebGLPlugin': './SpineWebGLPlugin.js',
|
||||
'SpineWebGLPlugin.min': './SpineWebGLPlugin.js'
|
||||
},
|
||||
|
||||
output: {
|
||||
path: `${__dirname}/dist/`,
|
||||
filename: '[name].js',
|
||||
library: 'SpineWebGLPlugin',
|
||||
libraryTarget: 'umd',
|
||||
sourceMapFilename: '[file].map',
|
||||
devtoolModuleFilenameTemplate: 'webpack:///[resource-path]', // string
|
||||
devtoolFallbackModuleFilenameTemplate: 'webpack:///[resource-path]?[hash]', // string
|
||||
umdNamedDefine: true
|
||||
},
|
||||
|
||||
performance: { hints: false },
|
||||
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: require.resolve('./src/runtimes/spine-canvas.js'),
|
||||
use: 'imports-loader?this=>window'
|
||||
},
|
||||
{
|
||||
test: require.resolve('./src/runtimes/spine-canvas.js'),
|
||||
use: 'exports-loader?spine'
|
||||
},
|
||||
{
|
||||
test: require.resolve('./src/runtimes/spine-webgl.js'),
|
||||
use: 'imports-loader?this=>window'
|
||||
},
|
||||
{
|
||||
test: require.resolve('./src/runtimes/spine-webgl.js'),
|
||||
use: 'exports-loader?spine'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
resolve: {
|
||||
alias: {
|
||||
'SpineCanvas': './runtimes/spine-canvas.js',
|
||||
'SpineWebGL': './runtimes/spine-webgl.js'
|
||||
},
|
||||
},
|
||||
|
||||
optimization: {
|
||||
minimizer: [
|
||||
new UglifyJSPlugin({
|
||||
include: /\.min\.js$/,
|
||||
parallel: true,
|
||||
sourceMap: false,
|
||||
uglifyOptions: {
|
||||
compress: true,
|
||||
ie8: false,
|
||||
ecma: 5,
|
||||
output: {comments: false},
|
||||
warnings: false
|
||||
},
|
||||
warningsFilter: () => false
|
||||
})
|
||||
]
|
||||
},
|
||||
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
"typeof CANVAS_RENDERER": JSON.stringify(false),
|
||||
"typeof WEBGL_RENDERER": JSON.stringify(true)
|
||||
}),
|
||||
new CleanWebpackPlugin([ 'dist' ]),
|
||||
{
|
||||
apply: (compiler) => {
|
||||
compiler.hooks.afterEmit.tap('AfterEmitPlugin', (compilation) => {
|
||||
exec('node plugins/spine/copy-to-examples.js', (err, stdout, stderr) => {
|
||||
if (stdout) process.stdout.write(stdout);
|
||||
if (stderr) process.stderr.write(stderr);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
Loading…
Reference in a new issue