Skip to content
Snippets Groups Projects
webpack.config.js 1.01 KiB
Newer Older
  • Learn to ignore specific revisions
  • const HtmlWebpackPlugin = require('html-webpack-plugin');
    
    const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin');
    
    Markin Igor's avatar
    Markin Igor committed
    const CleanWebpackPlugin = require('clean-webpack-plugin')
    
    module.exports = {
      entry: {
    
        'viamapi-client': ['core-js/fn/promise', './src/viamapi-client.js'],
    
        'viamapi-iframe': ['babel-polyfill', './src/iframe/viamapi-iframe.js'],
    
      plugins: [
    
        new HtmlWebpackPlugin({  // Also generate a test.html
          filename: 'viamapi-iframe.html',
    
          template: 'src/iframe/viamapi-iframe.html',
    
          chunks: ['viamapi-iframe'],
          inlineSource: '.(js)$'
        }),
    
    Markin Igor's avatar
    Markin Igor committed
        new CleanWebpackPlugin(),
    
        new HtmlWebpackInlineSourcePlugin()
    
      module: {
        rules: [
          {
            test: /\.m?js$/,
    
            // We have to transpile every dependency to make it work for older browsers. (IE 11)
    
            //exclude: /node_modules/,
            use: {
              loader: 'babel-loader',
              options: {
                presets: ['@babel/preset-env']
              }
            }
          }
        ]