Skip to content

Commit

Permalink
fix dev server externals
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Jan 31, 2021
1 parent b5326f8 commit 1f2f9fe
Showing 1 changed file with 29 additions and 15 deletions.
44 changes: 29 additions & 15 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,29 @@ License ${pkg.license}${!minimize ? '\n\n' + license : ''}`;

const entry = isDevServer ? './demo/js/Server.js' : './src/module/main.js';

const externals = isDevServer ? undefined : {
'poly-decomp': {
commonjs: 'poly-decomp',
commonjs2: 'poly-decomp',
amd: 'poly-decomp',
root: 'decomp'
},
'matter-wrap': {
commonjs: 'matter-wrap',
commonjs2: 'matter-wrap',
amd: 'matter-wrap',
root: 'MatterWrap'
}
};
const externals = isDevServer ?
{
'matter-js': {
commonjs: 'matter-js',
commonjs2: 'matter-js',
amd: 'matter-js',
root: 'Matter'
}
} :
{
'poly-decomp': {
commonjs: 'poly-decomp',
commonjs2: 'poly-decomp',
amd: 'poly-decomp',
root: 'decomp'
},
'matter-wrap': {
commonjs: 'matter-wrap',
commonjs2: 'matter-wrap',
amd: 'matter-wrap',
root: 'MatterWrap'
}
};

return {
entry: { [name]: entry },
Expand Down Expand Up @@ -69,7 +78,8 @@ License ${pkg.license}${!minimize ? '\n\n' + license : ''}`;
path.resolve(__dirname, './demo'),
path.resolve(__dirname, './examples'),
path.resolve(__dirname, './node_modules/matter-tools/build'),
path.resolve(__dirname, './node_modules/pathseg')
path.resolve(__dirname, './node_modules/pathseg'),
path.resolve(__dirname, './node_modules/matter-wrap/build')
],
watchContentBase: true,
open: true,
Expand Down Expand Up @@ -101,6 +111,10 @@ License ${pkg.license}${!minimize ? '\n\n' + license : ''}`;
'/lib/pathseg.js': {
target: 'http://localhost:8000/',
pathRewrite: { '^/lib/pathseg.js' : '/pathseg.js' }
},
'/lib/matter-wrap.js': {
target: 'http://localhost:8000/',
pathRewrite: { '^/lib/matter-wrap.js' : '/matter-wrap.js' }
}
}
}
Expand Down

0 comments on commit 1f2f9fe

Please sign in to comment.