Code Monkey home page Code Monkey logo

Comments (2)

fazibear avatar fazibear commented on June 2, 2024

When I try to bundle it with webpack, got ReferenceError: Collectable is not defined

from elixirscript.

fazibear avatar fazibear commented on June 2, 2024

I'm tying to fix ReferenceError: Collectable is not defined, but really don't know where I should start.

This is the source:

defmodule ElixirGame do
  @moduledoc """
  Documentation for ElixirGame.
  """

  def start(_, _) do
    for n <- 1..10 do
      n
    end
    # Enum.map(1..10, fn n ->
    #   ElixirGame.Helpers.log(n)
    # end)
  end
end

and this is the result:

'use strict';
import ElixirScript from './ElixirScript.Core.js';
import $Range$ from './Elixir.Range.js';

function __info__(kind) {
    const __info__map__ = new Map([[Symbol.for('functions'), [new ElixirScript.Core.Tuple(Symbol.for('start'), 2)]], [Symbol.for('macros'), []], [Symbol.for('attributes'), [new ElixirScript.Core.Tuple(Symbol.for('vsn'), [289843188494319781641132842991731571301])]], [Symbol.for('compile'), [new ElixirScript.Core.Tuple(Symbol.for('version'), [55, 46, 51, 46, 50]), new ElixirScript.Core.Tuple(Symbol.for('options'), [Symbol.for('dialyzer'), Symbol.for('no_spawn_compiler_process'), Symbol.for('from_core'), Symbol.for('no_auto_import')]), new ElixirScript.Core.Tuple(Symbol.for('source'), '/Users/fazibear/dev/elixir_game/lib/elixir_game.ex')]], [Symbol.for('md5'), new ElixirScript.Core.BitString(ElixirScript.Core.BitString.integer(218), ElixirScript.Core.BitString.integer(13), ElixirScript.Core.BitString.integer(196), ElixirScript.Core.BitString.integer(128), ElixirScript.Core.BitString.integer(195), ElixirScript.Core.BitString.integer(174), ElixirScript.Core.BitString.integer(25), ElixirScript.Core.BitString.integer(160), ElixirScript.Core.BitString.integer(239), ElixirScript.Core.BitString.integer(197), ElixirScript.Core.BitString.integer(117), ElixirScript.Core.BitString.integer(37), ElixirScript.Core.BitString.integer(227), ElixirScript.Core.BitString.integer(147), ElixirScript.Core.BitString.integer(122), ElixirScript.Core.BitString.integer(101))], [Symbol.for('module'), Symbol.for('Elixir.ElixirGame')]]);

    const value = __info__map__.get(kind);

    if (value !== null) {
        return value;
    }

    throw new ElixirScript.Core.Patterns.MatchError(kind);
}

function start(...__function_args__) {
    function recur(...__function_args__) {
        let __arg_matches__ = null;

        let __intermediate__ = null;

        if ((__arg_matches__ = ElixirScript.Core.Patterns.match_or_default([ElixirScript.Core.Patterns.variable('_'), ElixirScript.Core.Patterns.variable('_')], __function_args__, () => {
            return true;
        })) !== null) {
            let [] = __arg_matches__;

            return ElixirScript.Core.SpecialForms._for(ElixirScript.Core.Patterns.clause([ElixirScript.Core.Patterns.variable('n')], (n0) => {
                return n;
            }, () => {
                return true;
            }), [ElixirScript.Core.Patterns.list_generator(ElixirScript.Core.Patterns.variable('n'), new Map([[Symbol.for('__struct__'), $Range$], [Symbol.for('first'), 1], [Symbol.for('last'), 10]]))], Collectable, []);
        }

        throw new ElixirScript.Core.Patterns.MatchError(__function_args__);
    }

    return ElixirScript.Core.Functions.trampoline(new ElixirScript.Core.Functions.Recurse(recur.bind(null, ...__function_args__)));
}

export default {
    start,
    __MODULE__: Symbol.for('Elixir.ElixirGame'),
    __info__
};

I'm wondering what's wrong? Why there import for collectable is missing? The problem is with code generation or maybe the problem is where compiler adding imports? Need a little help with that :)

from elixirscript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.