webpack.config.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. /*alias: {
  23. "babylonjs": __dirname + '/../dist/preview release/babylon.max.js'
  24. }*/
  25. },
  26. externals: {
  27. babylonjs: true
  28. },
  29. plugins: [
  30. new webpack.WatchIgnorePlugin([
  31. /\.d\.ts$/
  32. ]),
  33. // fixing a small issue when root is an array and not a string
  34. new webpack.SourceMapDevToolPlugin({
  35. namespace: "BABYLON.GUI"
  36. })
  37. ],
  38. module: {
  39. rules: [{ test: /\.tsx?$/, loader: "ts-loader", exclude: /node_modules/ }]
  40. },
  41. mode: "development",
  42. devServer: {
  43. contentBase: path.join(__dirname, "dist"),
  44. compress: false,
  45. //open: true,
  46. port: 9000
  47. }
  48. }
  49. //]