Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. const ExtractTextPlugin = require('extract-text-webpack-plugin');
  4. const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
  5. require('babel-polyfill');
  6. const VueLoaderPlugin = require('vue-loader/lib/plugin');
  7. const {
  8. CheckerPlugin
  9. } = require('awesome-typescript-loader');
  10. const FilterWarningsPlugin = require('webpack-filter-warnings-plugin');
  11.  
  12.  
  13. const BUILD_DIR = path.resolve(__dirname, 'src/dist/public');
  14. const APP_KING_DIR = path.resolve(__dirname, 'src/king');
  15. const APP_KONG_DIR = path.resolve(__dirname, 'src/kong');
  16. const APP_AVATAR_DIR = path.resolve(__dirname, 'src/vue');
  17. const APP_ANGULAR_DIR = path.resolve(__dirname, 'src/angular');
  18.  
  19. module.exports = {
  20. cache: true,
  21. entry: {
  22. polyfills: './src/angular/polyfills.ts',
  23. king: ['babel-polyfill', APP_KING_DIR + '/index.js'],
  24. kong: [APP_KONG_DIR + '/index.js'],
  25. vue: [APP_AVATAR_DIR + '/main.js'],
  26. angular: [APP_ANGULAR_DIR + '/app.ts']
  27. },
  28. output: {
  29. path: path.resolve('./src/dist/public'),
  30. filename: '[name].js',
  31. },
  32. module: {
  33. rules: [{
  34. test: /\.(js|jsx)$/,
  35. exclude: /(node_modules|bower_components)/,
  36. use: {
  37. loader: 'babel-loader',
  38. options: {
  39. presets: ['@babel/preset-env'],
  40. },
  41. },
  42. },
  43. {
  44. test: /\.scss$/,
  45. use: [
  46. "to-string-loader",
  47. "style-loader", // creates style nodes from JS strings
  48. "css-loader", // translates CSS into CommonJS
  49. "sass-loader" // compiles Sass to CSS, using Node Sass by default
  50. ]
  51. },
  52. {
  53. test: /\.vue$/,
  54. loader: 'vue-loader'
  55. },
  56. {
  57. test: /\.css$/,
  58. use: [
  59. 'vue-style-loader',
  60. 'css-loader'
  61. ]
  62. },
  63. {
  64. test: /\.tsx?$/,
  65. loaders: [{
  66. loader: 'awesome-typescript-loader',
  67. }]
  68. },
  69. {
  70. test: /\.html$/,
  71. loader: "html-loader"
  72. },
  73. ],
  74. },
  75. resolve: {
  76. extensions: ['*', '.js', '.jsx', '.vue', '.ts', '.tsx'],
  77. },
  78. plugins: [
  79. new ExtractTextPlugin('bundle.css'),
  80. new webpack.DllReferencePlugin({
  81. manifest: require(path.join(BUILD_DIR, 'lib-manifest.json')),
  82. extensions: ['.js', '.jsx'],
  83. }),
  84. new VueLoaderPlugin(),
  85. new CheckerPlugin(),
  86. new webpack.ContextReplacementPlugin(
  87. /\@angular(\\|\/)core(\\|\/)fesm5/,
  88. path.resolve(__dirname, 'src/angular'), {}
  89. ),
  90. new FilterWarningsPlugin({
  91. exclude: /System.import/
  92. })
  93.  
  94. ],
  95. optimization: {
  96. minimizer: [
  97. new UglifyJSPlugin({
  98. uglifyOptions: {
  99. compress: {
  100. drop_console: true,
  101. },
  102. },
  103. }),
  104. ],
  105. },
  106. performance: {
  107. hints: false,
  108. },
  109. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement