Blog>
Snippets

Configuring Webpack for TanStack Ranger Core

Display a basic webpack configuration that includes TanStack Ranger Core as part of the bundle.
const path = require('path');

module.exports = {
    entry: './src/index.js',
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'dist'),
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: ['@babel/preset-env', '@babel/preset-react'],
                        plugins: [['@tanstack/babel-plugin', { core: true }]]
                    }
                }
            }
        ]
    }
};
This is a basic Webpack configuration that includes setting up the entry and output for your bundle, as well as configuring Babel to transpile your JS code. Notably, it includes the '@tanstack/babel-plugin' with the core option set to true, thus configuring Webpack to bundle TanStack Ranger Core as part of your project.