webpack.config.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. const babylonExternals = require('../Tools/WebpackPlugins/babylonExternals');
  4. const MiniCssExtractPlugin = require("mini-css-extract-plugin");
  5. const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
  6. module.exports = {
  7. context: path.resolve(__dirname, './src'),
  8. entry: {
  9. 'babylonjs-inspector': path.resolve(__dirname, './src/legacy/legacy.ts'),
  10. },
  11. output: {
  12. path: path.resolve(__dirname, '../dist/preview release/inspector'),
  13. filename: 'babylon.inspector.bundle.js',
  14. libraryTarget: 'umd',
  15. library: {
  16. root: "INSPECTOR",
  17. amd: "babylonjs-inspector",
  18. commonjs: "babylonjs-inspector"
  19. },
  20. umdNamedDefine: true
  21. },
  22. resolve: {
  23. extensions: [".js", '.ts', ".tsx"],
  24. alias: {
  25. "re-resizable$": path.resolve(__dirname, '../node_modules/re-resizable/lib/index.es5.js')
  26. }
  27. },
  28. externals: [babylonExternals()],
  29. devtool: "source-map",
  30. module: {
  31. rules: [{
  32. test: /\.tsx?$/,
  33. loader: 'awesome-typescript-loader',
  34. options: {
  35. configFileName: path.resolve(__dirname, './tsconfig.json'),
  36. declaration: false
  37. }
  38. },
  39. {
  40. test: /\.scss$/,
  41. use: [
  42. // fallback to style-loader in development
  43. process.env.NODE_ENV !== 'production' ? 'style-loader' : MiniCssExtractPlugin.loader,
  44. "css-loader",
  45. "sass-loader"
  46. ]
  47. },
  48. {
  49. test: /\.css$/,
  50. use: ['style-loader', 'css-loader']
  51. }]
  52. },
  53. mode: "production",
  54. performance: {
  55. hints: false
  56. },
  57. plugins: [
  58. new HardSourceWebpackPlugin(),
  59. new webpack.WatchIgnorePlugin([
  60. /\.js$/,
  61. /\.d\.ts$/
  62. ]),
  63. new MiniCssExtractPlugin({
  64. // Options similar to the same options in webpackOptions.output
  65. // both options are optional
  66. filename: "[name].css",
  67. chunkFilename: "[id].css"
  68. })
  69. ]
  70. }