webpack.config.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. umdNamedDefine: true,
  17. //devtoolModuleFilenameTemplate: '[relative-resource-path]'
  18. },
  19. resolve: {
  20. extensions: [".js", '.ts']
  21. },
  22. externals: {
  23. babylonjs: {
  24. root: "BABYLON",
  25. commonjs: "babylonjs",
  26. commonjs2: "babylonjs",
  27. amd: "babylonjs"
  28. }
  29. },
  30. plugins: [
  31. // fixing a small issue when root is an array and not a string
  32. /*new webpack.SourceMapDevToolPlugin({
  33. filename: '[name].js.map',
  34. })*/
  35. ],
  36. devtool: "source-map",
  37. module: {
  38. rules: [{
  39. test: /\.tsx?$/,
  40. loader: "ts-loader",
  41. exclude: /node_modules/
  42. },
  43. {
  44. test: /\.fx$/,
  45. use: [{
  46. loader: path.resolve('../Tools/WebpackShaderLoader/index.js')
  47. }]
  48. }]
  49. },
  50. mode: "development",
  51. devServer: {
  52. contentBase: path.join(__dirname, "dist"),
  53. compress: false,
  54. //open: true,
  55. port: 9000
  56. }
  57. }
  58. //]