Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var path = require('path');
- var webpack = require('webpack');
- module.exports = {
- plugins: [
- new webpack.ProvidePlugin({
- 'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
- })
- ],
- entry: {
- demo1 : ['babel-polyfill', './src/js/page/demo1.js']
- },
- output: {
- path: 'dist/js/page',
- filename: '[name].js'
- },
- devtool: 'eval-source-map',
- module: {
- loaders: [
- {
- test: /.js$/,
- include: [
- path.resolve(__dirname, "src")
- ],
- exclude: path.resolve(__dirname, "node_modules"),
- loader: "babel-loader",
- query: {
- plugins: ['transform-runtime'],
- presets: ['es2015', 'react']
- }
- },
- { test: /.scss$/, loader: 'style!css!sass?sourceMap'}
- ]
- },
- resolve: {
- root: path.resolve(__dirname, "src"),
- extensions: ['', '.js', '.json', '.scss']
- }
- };
- require('core-js/fn/array/from');
- // Then, from within any module:
- Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
- import polyfill from 'dynamic-polyfill'
- polyfill({
- fills: ['Array.from'],
- afterFill() {
- // your code
- }
- })
Add Comment
Please, Sign In to add comment