webpack.config.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. module.exports = {
  4. entry: {
  5. 'babylonjs-gui': './src/index.ts',
  6. },
  7. output: {
  8. path: path.resolve(__dirname, 'dist'),
  9. filename: '[name].js',
  10. libraryTarget: 'umd',
  11. library: {
  12. root: ["BABYLON", "GUI"],
  13. amd: "babylonjs-gui",
  14. commonjs: "babylonjs-gui"
  15. },
  16. //globalObject: "BABYLON",
  17. umdNamedDefine: true,
  18. devtoolModuleFilenameTemplate: '[relative-resource-path]'
  19. },
  20. resolve: {
  21. extensions: [".js", '.ts']
  22. },
  23. externals: {
  24. babylonjs: {
  25. root: "BABYLON",
  26. commonjs: "babylonjs",
  27. commonjs2: "babylonjs",
  28. amd: "babylonjs"
  29. }
  30. },
  31. plugins: [
  32. new webpack.WatchIgnorePlugin([
  33. /\.d\.ts$/
  34. ]),
  35. // fixing a small issue when root is an array and not a string
  36. /*new webpack.SourceMapDevToolPlugin({
  37. namespace: "BABYLON.GUI"
  38. })*/
  39. ],
  40. module: {
  41. rules: [
  42. {
  43. test: /\.tsx?$/,
  44. loader: "ts-loader",
  45. exclude: /node_modules/
  46. },
  47. {
  48. test: /\.fx$/,
  49. use: [
  50. {
  51. loader: path.resolve('../Tools/WebpackShaderLoader/index.js')
  52. }
  53. ]
  54. }]
  55. },
  56. mode: "development",
  57. devServer: {
  58. contentBase: path.join(__dirname, "dist"),
  59. compress: false,
  60. //open: true,
  61. port: 9000
  62. }
  63. }
  64. //]