src_js/iconolab-bundle/webpack.config.js
author ymh <ymh.work@gmail.com>
Wed, 06 Jun 2018 16:21:54 +0200
changeset 539 08e2513dbc2f
parent 418 a04c55054afe
child 541 4aa4664b0343
permissions -rw-r--r--
Upgrade webpack to 4, upgrade vue.js, and some style changes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
539
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
     1
const path = require('path')
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
     2
const webpack = require('webpack')
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
     3
const ExtractTextPlugin = require('extract-text-webpack-plugin')
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
     4
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
     5
const projectRoot = path.resolve(__dirname)
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
     6
const VueLoaderPlugin = require('vue-loader/lib/plugin')
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
     7
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin')
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
     8
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
     9
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    10
const cssLoaders = [{
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    11
  loader: 'css-loader',
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    12
  options: {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    13
    module: true,
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    14
    localIdentName: '[local]'
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    15
  }
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    16
}]
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    17
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    18
const scssLoaders = [
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    19
  {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    20
    loader: 'css-loader',
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    21
    options: {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    22
      module: true,
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    23
      localIdentName: '[local]',
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    24
      importLoaders: 1
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    25
    }
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    26
  },
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    27
  {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    28
    loader: 'resolve-url-loader'
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    29
  },
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    30
  {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    31
    loader: 'postcss-loader'
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    32
  },
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    33
  {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    34
    loader: 'sass-loader'
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    35
  }
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    36
]
146
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    37
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    38
module.exports = {
309
c5b524696fb3 Improve JS/CSS compilation.
Alexandre Segura <mex.zktk@gmail.com>
parents: 299
diff changeset
    39
  entry: {
316
ffa87fe82904 Missing webpack.config.js from previous commit.
Alexandre Segura <mex.zktk@gmail.com>
parents: 309
diff changeset
    40
    vendor: [
ffa87fe82904 Missing webpack.config.js from previous commit.
Alexandre Segura <mex.zktk@gmail.com>
parents: 309
diff changeset
    41
      'jquery',
539
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    42
      'bootstrap'
316
ffa87fe82904 Missing webpack.config.js from previous commit.
Alexandre Segura <mex.zktk@gmail.com>
parents: 309
diff changeset
    43
    ],
309
c5b524696fb3 Improve JS/CSS compilation.
Alexandre Segura <mex.zktk@gmail.com>
parents: 299
diff changeset
    44
    iconolab: [
359
e435cad79dfe Move JS conf files back to iconolab-bundle folder.
Alexandre Segura <mex.zktk@gmail.com>
parents: 316
diff changeset
    45
      './src/main.js',
539
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    46
      './src/main.scss'
309
c5b524696fb3 Improve JS/CSS compilation.
Alexandre Segura <mex.zktk@gmail.com>
parents: 299
diff changeset
    47
    ]
c5b524696fb3 Improve JS/CSS compilation.
Alexandre Segura <mex.zktk@gmail.com>
parents: 299
diff changeset
    48
  },
146
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    49
  output: {
539
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    50
    path: path.join(__dirname, '/../../src/iconolab/static'),
309
c5b524696fb3 Improve JS/CSS compilation.
Alexandre Segura <mex.zktk@gmail.com>
parents: 299
diff changeset
    51
    publicPath: '/static/',
c5b524696fb3 Improve JS/CSS compilation.
Alexandre Segura <mex.zktk@gmail.com>
parents: 299
diff changeset
    52
    filename: 'iconolab/js/[name].js'
146
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    53
  },
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    54
  module: {
539
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    55
    rules: [{
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    56
      test: /\.vue$/,
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    57
      loader: 'vue-loader'
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    58
    },
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    59
    {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    60
      test: /\.css$/,
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    61
      loader: ExtractTextPlugin.extract({
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    62
        fallback: 'style-loader',
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    63
        use: cssLoaders
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    64
      }),
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    65
      include: [
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    66
        path.join(__dirname, '/src'),
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    67
        /node_modules/
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    68
      ]
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    69
    },
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    70
    {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    71
      test: /\.scss$/,
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    72
      loader: ExtractTextPlugin.extract({
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    73
        fallback: 'style-loader',
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    74
        use: scssLoaders
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    75
      }),
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    76
      include: [
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    77
        path.join(__dirname, '/src'),
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    78
        /node_modules/
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    79
      ]
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    80
    },
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    81
    {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    82
      test: /\.js$/,
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    83
      use: [{
146
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    84
        loader: 'babel-loader',
539
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    85
        options: {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    86
          presets: ['es2015'],
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    87
          plugins: ['transform-es2015-shorthand-properties', 'lodash']
146
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
    88
        }
539
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    89
      }],
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    90
      exclude: /node_modules/,
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    91
      include: [
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    92
        path.join(projectRoot, 'src')
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    93
      ]
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    94
    },
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    95
    {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    96
      test: /\.(png|jpg|gif|svg)$/,
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    97
      loader: 'file-loader',
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    98
      query: {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
    99
        name: '[name].[ext]?[hash]'
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   100
      }
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   101
    },
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   102
    {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   103
      test: /\.(ttf|eot|svg|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   104
      loader: 'file-loader?name=[name].[ext]&publicPath=../fonts/&outputPath=iconolab/fonts/'
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   105
    },
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   106
    {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   107
      test: require.resolve('snapsvg'),
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   108
      loader: 'imports-loader?this=>window,fix=>module.exports=0'
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   109
    },
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   110
    {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   111
      test: require.resolve('jquery'),
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   112
      use: [{
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   113
        loader: 'expose-loader',
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   114
        options: 'JQuery'
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   115
      }, {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   116
        loader: 'expose-loader',
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   117
        options: '$'
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   118
      }]
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   119
    },
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   120
    {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   121
      test: require.resolve('vue/dist/vue.min'),
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   122
      use: [{
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   123
        loader: 'expose-loader',
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   124
        options: 'Vue'
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   125
      }]
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   126
    }
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   127
    ]},
309
c5b524696fb3 Improve JS/CSS compilation.
Alexandre Segura <mex.zktk@gmail.com>
parents: 299
diff changeset
   128
  plugins: [
539
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   129
    new ExtractTextPlugin('iconolab/css/[name].css'),
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   130
    new VueLoaderPlugin(),
309
c5b524696fb3 Improve JS/CSS compilation.
Alexandre Segura <mex.zktk@gmail.com>
parents: 299
diff changeset
   131
    new webpack.ProvidePlugin({
539
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   132
      $: 'jquery',
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   133
      jQuery: 'jquery',
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   134
      Popper: ['popper.js', 'default']
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   135
    }),
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   136
    new LodashModuleReplacementPlugin(),
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   137
    new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /fr/)
309
c5b524696fb3 Improve JS/CSS compilation.
Alexandre Segura <mex.zktk@gmail.com>
parents: 299
diff changeset
   138
  ],
146
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
   139
  devServer: {
309
c5b524696fb3 Improve JS/CSS compilation.
Alexandre Segura <mex.zktk@gmail.com>
parents: 299
diff changeset
   140
    port: 8001,
539
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   141
    contentBase: path.join(__dirname, '/../../src/iconolab'),
309
c5b524696fb3 Improve JS/CSS compilation.
Alexandre Segura <mex.zktk@gmail.com>
parents: 299
diff changeset
   142
    publicPath: '/static/',
c5b524696fb3 Improve JS/CSS compilation.
Alexandre Segura <mex.zktk@gmail.com>
parents: 299
diff changeset
   143
    stats: 'minimal',
c5b524696fb3 Improve JS/CSS compilation.
Alexandre Segura <mex.zktk@gmail.com>
parents: 299
diff changeset
   144
    compress: true,
539
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   145
    headers: {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   146
      'Access-Control-Allow-Origin': '*'
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   147
    },
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   148
    historyApiFallback: true
146
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
   149
  },
539
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   150
  devtool: '#source-map',
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   151
  performance: { hints: false },
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   152
  optimization: {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   153
    splitChunks: { // CommonsChunkPlugin()
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   154
      name: 'vendor'
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   155
    },
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   156
    minimizer: [
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   157
      new UglifyJsPlugin({
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   158
        uglifyOptions: {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   159
          ie8: false,
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   160
          mangle: true,
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   161
          output: {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   162
            comments: false,
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   163
            beautify: false
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   164
          },
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   165
          compress: true,
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   166
          warnings: false,
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   167
          ecma: 6
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   168
        },
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   169
        sourceMap: true
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   170
      })
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   171
    ]
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   172
  }
146
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
   173
}
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
   174
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
   175
if (process.env.NODE_ENV === 'production') {
539
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   176
  module.exports.mode = 'production'
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   177
  module.exports.devtool = false
146
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
   178
  // http://vue-loader.vuejs.org/en/workflow/production.html
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
   179
  module.exports.plugins = (module.exports.plugins || []).concat([
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
   180
    new webpack.DefinePlugin({
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
   181
      'process.env': {
539
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   182
        'NODE_ENV': '"production"'
146
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
   183
      }
539
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   184
    })
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   185
  ])
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   186
} else {
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   187
  module.exports.mode = 'development'
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   188
  module.exports.plugins = (module.exports.plugins || []).concat([
08e2513dbc2f Upgrade webpack to 4, upgrade vue.js, and some style changes
ymh <ymh.work@gmail.com>
parents: 418
diff changeset
   189
    new BundleAnalyzerPlugin()
146
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
   190
  ])
f912b591e1c1 new src_js folder
Harris Baptiste <harris.baptiste@iri.centrepompidou.fr>
parents:
diff changeset
   191
}