1

我有一个奇怪的问题,我似乎无法解决。

我收到此错误:

Error: Can't resolve 'store/configureStore' in '/Users/samboy/company/oh-frontend/app'

我的 webpack 文件如下所示:

   name: 'browser',
    context: path.join(__dirname, '..', '..', '..', 'app'),
    entry: {
      app: './client'
    },
    output: {
      // The output directory as absolute path
      path: assetsPath,
      // The filename of the entry chunk as relative path inside the output.path directory
      filename: '[name].js',
      // The output path from the view of the Javascript
      publicPath: publicPath

    },

    module: {
      loaders: commonLoaders
    },
    resolve: {
      modules: [
        path.resolve(__dirname, '..', '..', '..', 'app'),
        'node_modules'
      ],
      extensions: ['', '.js', '.jsx', '.css']
    },
    plugins: [
        // extract inline css from modules into separate files
        new ExtractTextPlugin('styles/bundled-modules.css'),
        // files in global directory should be concatenated into one file for prod
        new CopyWebpackPlugin([
            { from: 'fonts/', to: 'fonts/' }
            , { from: '_web/css/global/fonts.css', to: 'styles/fonts.css' }
            , { from: '_web/css/vendors', to: 'styles/vendors' }
        ]),
        new webpack.optimize.UglifyJsPlugin({
          compressor: {
            warnings: false
          }
        }),
        new webpack.DefinePlugin({
          __DEVCLIENT__: false,
          __DEVSERVER__: false,
          __PLATFORM_WEB__: true,
          __PLATFORM_IOS__: false
        }),
        new InlineEnviromentVariablesPlugin({ NODE_ENV: 'production' }),function()
    {
        this.plugin("done", function(stats)
        {
            if (stats.compilation.errors && stats.compilation.errors.length)
            {
                console.log(stats.compilation.errors);
                process.exit(1);
            }
            // ...
        });
    }
    ],
    postcss: postCSSConfig
  }

该文件肯定存在于该文件夹中。它在 webpack 上运行良好。不过,它似乎不适用于 webpack2。

4

1 回答 1

0

我猜是因为您没有发布您的应用程序文件,但是您可以将应用程序文件中的导入语句更改为“./store/configureStore”吗?

于 2016-09-23T16:11:11.113 回答