您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

common.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /**
  2. * @Author: Caven
  3. * @Date: 2021-03-13 12:09:44
  4. */
  5. 'use strict'
  6. const webpack = require('webpack')
  7. const packageInfo = require('../package.json')
  8. const MiniCssExtractPlugin = require('mini-css-extract-plugin')
  9. function getTime() {
  10. let now = new Date()
  11. let m = now.getMonth() + 1
  12. m = m < 10 ? '0' + m : m
  13. let d = now.getDate()
  14. d = d < 10 ? '0' + d : d
  15. return `${now.getFullYear()}-${m}-${d}`
  16. }
  17. module.exports = {
  18. rules: [
  19. {
  20. test: /\.js$/,
  21. exclude: /node_modules/,
  22. loader: 'babel-loader',
  23. options: {
  24. presets: ['@babel/preset-env'],
  25. plugins: ['@babel/transform-runtime'],
  26. compact: false,
  27. ignore: ['checkTree']
  28. }
  29. },
  30. {
  31. test: /\.css$/,
  32. use: [
  33. MiniCssExtractPlugin.loader,
  34. {
  35. loader: 'css-loader'
  36. },
  37. {
  38. loader: 'sass-loader'
  39. }
  40. ]
  41. },
  42. {
  43. test: /\.scss$/,
  44. use: [
  45. MiniCssExtractPlugin.loader,
  46. {
  47. loader: 'css-loader'
  48. },
  49. {
  50. loader: 'sass-loader'
  51. }
  52. ]
  53. },
  54. {
  55. test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
  56. loader: 'url-loader',
  57. options: {
  58. limit: 20000
  59. }
  60. },
  61. {
  62. test: /\.glsl$/,
  63. loader: 'webpack-glsl-loader'
  64. }
  65. ],
  66. plugins: [
  67. new webpack.DefinePlugin({
  68. CESIUM_BASE_URL: JSON.stringify('./libs/dc-sdk/resources/'),
  69. __VERSION__: JSON.stringify(packageInfo.version),
  70. __TIME__: JSON.stringify(getTime()),
  71. __AUTHOR__: JSON.stringify(packageInfo.author),
  72. __REPOSITORY__: JSON.stringify(packageInfo.repository),
  73. __HOME_PAGE__: JSON.stringify(packageInfo.homepage)
  74. })
  75. ]
  76. }