Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

withTracker is undefined starting from react-meteor-data@2.0.1 #90

Open
Fanaticys opened this issue Apr 15, 2020 · 2 comments
Open

withTracker is undefined starting from react-meteor-data@2.0.1 #90

Fanaticys opened this issue Apr 15, 2020 · 2 comments

Comments

@Fanaticys
Copy link

Fanaticys commented Apr 15, 2020

It works with react-meteor-data@1.0.0 but starting from 2.0.1 withTracker is undefined.
Also react-meteor-data@2.0.1 works without meteor-webpack package.

import { withTracker } from 'meteor/react-meteor-data';
console.log(withTracker); // undefined
// webpack.config.js

const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const meteorExternals = require('webpack-meteor-externals');
const path = require('path');

const clientConfig = {
  entry: './client/index.js',
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
          options: {
            configFile: path.resolve(__dirname, './.babelrc'),
          },
        },
      },
      {
        test: /\.s[ac]ss$/i,
        loader: [
          'style-loader',
          {
            loader: 'css-loader',
            options: {
              modules: {
                auto: true,
                localIdentName: '[path][name]__[local]',
              },
            },
          },
          {
            loader: 'sass-loader',
          },
        ],
      },
      {
        test: /\.(png|svg|jpg|gif)$/,
        use: ['file-loader'],
      },
      {
        test: /\.css$/,
        use: ['style-loader', 'css-loader'],
      },
      {
        test: /\.(woff|woff2|eot|ttf|otf)$/,
        use: ['file-loader'],
      },
    ],
  },
  devtool: 'eval-source-map',
  output: {
    publicPath: '/',
  },
  resolve: {
    alias: {
      '/imports': path.resolve(__dirname, './imports'),
    },
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './client/index.html',
    }),
    new webpack.HotModuleReplacementPlugin(),
  ],
  externals: [meteorExternals()],
  devServer: {
    hot: true,
  },
};

const serverConfig = {
  entry: ['./server/main.js'],
  target: 'node',
  devServer: {
    hot: true,
  },
  externals: [meteorExternals()],
  resolve: {
    alias: {
      '/imports': path.resolve(__dirname, './imports'),
    },
  },
};

module.exports = [clientConfig, serverConfig];

@schlaegerz
Copy link

Is there any fix for this?

@Fanaticys
Copy link
Author

Fanaticys commented Aug 11, 2020

After my investigations, I clarified that it happens in 2.0.1 version of react-meteor-data package. The reason why I mentioned 2.0.0 is that even I install react-meteor-data by specifying exact version 2.0.0 the latest version (currently 2.1.1) is installed. Also the reason of issue is new feature { lazy: true } in 2.0.1 version in package.js file of react-meteor-data package. Really I don't know what packages should fix the issue, because lazy loading it is a good practice and also I have read somewhere that ardatan:meteor-webpack has issue with lazy loading.

@Fanaticys Fanaticys changed the title withTracker is undefined starting from react-meteor-data@2.0.0 withTracker is undefined starting from react-meteor-data@2.0.1 Aug 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants