Guest User

Untitled

a guest
Nov 23rd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. var path = require('path');
  2. var webpack = require('webpack');
  3.  
  4. module.exports = {
  5. plugins: [
  6. new webpack.ProvidePlugin({
  7. 'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
  8. })
  9. ],
  10. entry: {
  11. demo1 : ['babel-polyfill', './src/js/page/demo1.js']
  12. },
  13.  
  14. output: {
  15. path: 'dist/js/page',
  16. filename: '[name].js'
  17. },
  18. devtool: 'eval-source-map',
  19. module: {
  20. loaders: [
  21. {
  22. test: /.js$/,
  23. include: [
  24. path.resolve(__dirname, "src")
  25. ],
  26. exclude: path.resolve(__dirname, "node_modules"),
  27. loader: "babel-loader",
  28. query: {
  29. plugins: ['transform-runtime'],
  30. presets: ['es2015', 'react']
  31. }
  32. },
  33. { test: /.scss$/, loader: 'style!css!sass?sourceMap'}
  34. ]
  35. },
  36. resolve: {
  37. root: path.resolve(__dirname, "src"),
  38. extensions: ['', '.js', '.json', '.scss']
  39. }
  40. };
  41.  
  42. require('core-js/fn/array/from');
  43.  
  44. // Then, from within any module:
  45. Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
  46.  
  47. import polyfill from 'dynamic-polyfill'
  48.  
  49. polyfill({
  50. fills: ['Array.from'],
  51. afterFill() {
  52. // your code
  53. }
  54. })
Add Comment
Please, Sign In to add comment