webpack.config.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. const path = require("path");
  2. const MiniCssExtractPlugin = require("mini-css-extract-plugin");
  3. const babylonWebpackConfig = require('../Tools/WebpackPlugins/babylonWebpackConfig');
  4. const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
  5. var config = babylonWebpackConfig({
  6. module: "playground",
  7. entry: "./legacy/legacy.ts",
  8. output: {
  9. globalObject: '(typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this)',
  10. filename: "babylon.playground.js",
  11. path: path.resolve(__dirname, "dist"),
  12. publicPath: "/dist/",
  13. libraryTarget: 'umd',
  14. library: {
  15. root: ["PLAYGROUND"],
  16. },
  17. umdNamedDefine: true
  18. },
  19. resolve: {
  20. extensions: [".js", '.ts', ".tsx"],
  21. },
  22. moduleRules: [
  23. {
  24. test: /\.scss$/,
  25. use: [
  26. // fallback to style-loader in development
  27. process.env.NODE_ENV !== 'production' ? 'style-loader' : MiniCssExtractPlugin.loader,
  28. "css-loader",
  29. "sass-loader"
  30. ]
  31. },
  32. {
  33. test: /\.css$/,
  34. use: ['style-loader', 'css-loader']
  35. },
  36. {
  37. test: /\.svg$/,
  38. use: ['@svgr/webpack']
  39. },
  40. {
  41. test: /\.ttf$/,
  42. use: ['file-loader']
  43. }
  44. ],
  45. plugins: [
  46. new MiniCssExtractPlugin({
  47. // Options similar to the same options in webpackOptions.output
  48. // both options are optional
  49. filename: "[name].css",
  50. chunkFilename: "[id].css"
  51. }),
  52. new MonacoWebpackPlugin({
  53. publicPath: "dist/",
  54. languages: [
  55. "typescript",
  56. "javascript"
  57. ]
  58. })
  59. ]
  60. });
  61. module.exports = config;