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

Dependency 'crc' breaks after its upgrade from 3.5.0 -> 3.6.0 #136

Closed
fullykubed opened this issue Jul 14, 2018 · 1 comment
Closed

Dependency 'crc' breaks after its upgrade from 3.5.0 -> 3.6.0 #136

fullykubed opened this issue Jul 14, 2018 · 1 comment

Comments

@fullykubed
Copy link

fullykubed commented Jul 14, 2018

Major Break

Importing 'crc' version 3.6.0 results in an undefined import when using stellar-sdk after bundling with webpack and sending it down to the client.

Code example that no longer works:

import stellar from 'stellar-sdk';
stellar.Keypair.fromSecret(secretKey);

Temporary fix for users:

Add the following to package.json:

{
   "dependencies": {
       "crc": "3.5.0"
   },
   "resolutions": {
       "crc": "3.5.0"
   }
}

Note: I've only tested this with yarn

For the debuggers, here is the webpack config file:

const path = require('path');
const glob = require('glob');

const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const OUTPUT_PATH = path.resolve(__dirname, '../dist');
const HTML_ENTRY = path.resolve(__dirname, '../static/index.html');

module.exports = {


    /***********************************************
     * Generic Configuration Options
     ***********************************************/


    entry: [
        'webpack-dev-server/client?http://localhost:3001',
        'webpack/hot/only-dev-server',
        path.resolve(__dirname, '../src/index.jsx')
    ],
    output: {
        path: OUTPUT_PATH,
        filename: 'bundle.js',
        publicPath: 'http://localhost:3001/',
    },

    resolve: {
        extensions: ['.mjs', '.js', '.jsx']
    },
    devtool: 'source-map',
    mode: 'development',
    watch: true,
    target: 'web',


    /***********************************************
     * Dev Server Config Options
     ***********************************************/

    devServer: {
        host: 'localhost',
        port: 3001,
        historyApiFallback: true,
        hot: true
    },


    /***********************************************
     * File Loaders
     ***********************************************/

    module: {
        rules: [

            //js
            {
                test: /\.(jsx|js)?$/,
                exclude: /(node_modules)/,
                use: {
                    loader: 'babel-loader',
                }
            },
            {
                test: /\.mjs$/,
                include: /node_modules/,
                type: "javascript/auto",
            },

            //images and fonts
            {
                test: /\.(woff|woff2|ttf|eot|jpe?g|png|gif)$/,
                use: {
                    loader: "url-loader",
                    options: {
                        limit: 8192
                    }
                }
            },

        ]
    },

    /***********************************************
     * Plugins
     ***********************************************/

    optimization: {
        minimize: false
    },

    plugins: [

        //configuration plguins
        new HtmlWebpackPlugin({
            template: HTML_ENTRY
        }),
        new webpack.NamedModulesPlugin(),
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoEmitOnErrorsPlugin(),
        new webpack.DefinePlugin({
            "process.env": {
                "BUILD_TARGET": JSON.stringify("client")
            }
        })

    ]
};
@bartekn
Copy link
Contributor

bartekn commented Jul 16, 2018

Strange, this should definitely work with yarn as 3.5.0 version is locked in yarn.lock file. However this can cause problems when using npm. Thanks for the report.
EDIT: OK, yarn.lock is in master but haven't been released yet. Fixed in 6bf9fbc. Releasing v0.8.0 with a fix.

@bartekn bartekn closed this as completed Jul 16, 2018
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