title: How to debug svelte-loader-hot giving me a "cannot find module 'svelte/package.json'" error?
body: <p>I'm trying to get svelte hot module replacement working with Meteor but the svelte-loader-hot package is giving me this error:</p>
  <p><code>ERROR in ./imports/App.svelte Module build failed (from ./node_modules/svelte-loader-hot/index.js): Error: Cannot find module 'svelte/package.json'</code></p>
  <p>The regular svelte-loader works fine. I'm assuming this has to do with my webpack config or that I'm using Meteor.</p>
  <p>I've installed svelte as a dependency but I guess it's having issues resolving?</p>
  <pre class="lang-js prettyprint-override"><code>//webpack.config.js
  const webpack = require('webpack');
  const path = require('path');
  const meteorExternals = require('webpack-meteor-externals');
  const HtmlWebpackPlugin = require('html-webpack-plugin');
  
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
  
  import { scss, postcss } from 'svelte-preprocess'
  
  const mode = process.env.NODE_ENV;
  const dev = mode === 'development';
  const hot = dev &amp;&amp; process.env.HOT != 0
  
  const clientConfig = {
      entry: './client/main.js',
      devtool: 'inline-source-map',
      output: {
          publicPath: '/'
      },
      externals: [meteorExternals()],
      mode,
      plugins: [
          hot &amp;&amp; new webpack.HotModuleReplacementPlugin(),
          new webpack.DefinePlugin({
              'process.browser': true,
              'process.env.NODE_ENV': JSON.stringify(mode)
          }),
          new MiniCssExtractPlugin({
              filename: '[name].css',
              chunkFilename: '[name].[id].css',
          }),
          new OptimizeCssAssetsPlugin({
              assetNameRegExp: /\.css$/g,
              cssProcessor: require('cssnano'),
              cssProcessorPluginOptions: {
                  preset: ['default', { discardComments: { removeAll: true } }],
              },
              canPrint: true
          }),
          new HtmlWebpackPlugin({
              template: './client/main.html'
          })
      ].filter(Boolean),
      module: {
          rules: [
              {
                  test: /\.(js)$/,
                  exclude: /node_modules/,
                  use: {
                      loader: 'babel-loader',
                      query: {
                          presets: [&quot;@babel/preset-env&quot;],
                      }
                  },
              },
              {
                  test: /\.(svelte)$/,
                  use: {
                      loader: 'svelte-loader-hot',
                      options: {
                          dev,
                          hydratable: true,
                          hotReload: hot,
                          hotOptions: {
                              optimistic: true,
                          },
                          preprocess: [
                              scss({
                                  includePaths: [
                                      './imports/theme',
                                      './node_modules',
                                      './imports/components'
                                  ]
                              }),
                              postcss()
                          ]
                      }
                  }
              },
              {
                  test: /\.s[ac]ss$/i,
                  use: [
                      'style-loader',
                      MiniCssExtractPlugin.loader,
                      'css-loader',
                      'postcss-loader',
                      {
                          loader: 'sass-loader',
                          options: {
                              sassOptions: {
                                  includePaths: [
                                      './imports/theme',
                                      './node_modules',
                                      './imports/components'
                                  ]
                              }
                          }
                      }
                  ]
              }
          ]
      }
  }
  
  const serverConfig = {
      target: 'node', // in order to ignore built-in modules like path, fs, etc.
      entry: './server/main.js',
      externals: [meteorExternals()],
      devServer: {
          hot: hot
      }
  }
  
  module.exports = [clientConfig, serverConfig];
  </code></pre>