mirror of
https://github.com/photonstorm/phaser
synced 2024-11-30 00:21:04 +00:00
74 lines
2 KiB
JavaScript
74 lines
2 KiB
JavaScript
'use strict';
|
|
|
|
const webpack = require('webpack');
|
|
const exec = require('child_process').exec;
|
|
const RemovePlugin = require('remove-files-webpack-plugin');
|
|
|
|
module.exports = {
|
|
mode: 'development',
|
|
|
|
context: `${__dirname}/src/`,
|
|
|
|
entry: {
|
|
'SpineCanvasPluginDebug': './SpinePlugin.js'
|
|
},
|
|
|
|
output: {
|
|
path: `${__dirname}/dist/`,
|
|
filename: '[name].js',
|
|
library: 'SpinePlugin',
|
|
libraryTarget: 'window',
|
|
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'
|
|
}
|
|
]
|
|
},
|
|
|
|
resolve: {
|
|
alias: {
|
|
'Spine': './runtimes/spine-canvas.js'
|
|
}
|
|
},
|
|
|
|
plugins: [
|
|
new webpack.DefinePlugin({
|
|
"typeof CANVAS_RENDERER": JSON.stringify(true),
|
|
"typeof WEBGL_RENDERER": JSON.stringify(false)
|
|
}),
|
|
new RemovePlugin({
|
|
before: {
|
|
before: {
|
|
root: './plugins/spine/dist/',
|
|
include: [ 'SpineCanvasPluginDebug.js', 'SpineCanvasPluginDebug.js.map' ]
|
|
}
|
|
}
|
|
}),
|
|
{
|
|
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);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
],
|
|
|
|
devtool: 'source-map'
|
|
};
|