import path from "path"

// ! client side loader only \\
export default ({ config }) => {
  const { webpackConfig } = config
  return {
    ...webpackConfig,
    module: {
      ...webpackConfig.module,
      loaders: [
        ...webpackConfig.module.loaders,
        {
          test: /\.json$/,
          loader: "json-loader",
        },
        {
          test: /\.js$/,
          loaders: [
            `babel-loader${
              config.dev ? "?presets[]=babel-preset-react-hmre" : ""
            }`,
            "eslint-loader?fix",
          ],
          include: [
            path.resolve(config.cwd, "scripts"),
            path.resolve(config.cwd, "web_modules"),
          ],
        },
      ],
    },

    entry: {
      "statinamic-client": path.join(__dirname, "index-client"),
    },
  }
}

@@ -17,16 +17,45 @@
  %22path%22%0A
+import webpack from %22webpack%22
 %0A// ! cl
@@ -817,24 +817,545 @@
 x-client%22),%0A
+      %22statinamic-bundle%22: %5B%0A        %22react%22,%0A        %22react-dom%22,%0A        %22redux%22,%0A        %22react-redux%22,%0A        %22react-helmet%22,%0A        %22whatwg-fetch%22,%0A      %5D,%0A    %7D,%0A%0A    ...config.production && %7B%0A      output: %7B%0A        ...webpackConfig.output,%0A        filename: %22%5Bname%5D.%5Bchunkhash%5D.js%22,%0A        chunkFilename: %22%5Bchunkhash%5D.js%22,%0A      %7D,%0A%0A      plugins: %5B%0A        ...webpackConfig.plugins,%0A        new webpack.optimize.CommonsChunkPlugin(%7B%0A          names: %5B %22statinamic-bundle%22, %22manifest%22 %5D,%0A        %7D),%0A      %5D,%0A
     %7D,%0A  %7D%0A%7D

Enable long term caching (don't change hash when no files changed)