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

First Release #1

Merged
merged 23 commits into from
Feb 2, 2017
Merged

First Release #1

merged 23 commits into from
Feb 2, 2017

Conversation

ericclemmons
Copy link
Owner

No description provided.

@ericclemmons ericclemmons self-assigned this Feb 12, 2016
@ericclemmons ericclemmons added this to the 1.0.0 milestone Feb 12, 2016
@ericclemmons
Copy link
Owner Author

This already needs refactoring to work from the inside-out:

  • Is it a function?
  • Is the function named like a component?
  • Is it a const?
  • Does it contain JSX?
  • Is it wrapped in a decorator?

@ericclemmons
Copy link
Owner Author

Well crap. This was coded in isolation based off of source, so only running it first works:

  module: {
    loaders: [
      {
        test: /\.js$/,
        loader: "babel",
        query: {
          babelrc: false,
          cacheDirectory: true,
          passPerPreset: true,
          presets: [
            {
              plugins: [
                "syntax-jsx",
                "../src/plugin.js",
              ],
            },
            "es2015",
            "stage-0",
            "react",
          ],
        },
        exclude: /node_modules/,
      },
    ],

It needs to be able to be ran after es2015, react, and stage-0 presets.

This...will significantly make it more difficult to tell what's a functional component and what's not...

@ericclemmons
Copy link
Owner Author

It's working!!

Next steps:

  • Rename repo to babel-plugin-react-pure-to-class
  • Add README.md, specific to the new Babel version & how to do multi-pass presets.
  • Video of demo. Make it prettier, too.
  • Rationale.
  • Note the auto-inclusion of React into scope.
  • Release!

@ericclemmons
Copy link
Owner Author

F*.

Major blocker in an internal project:

ERROR in ./src/routes/index.js
Module build failed: ReferenceError: [BABEL] /Users/Eric/Projects/highereducation/platform/src/routes/index.js: Unknown option: base.passPerPreset
    at Logger.error (/Users/Eric/Projects/highereducation/platform/src/node_modules/babel-core/lib/transformation/file/logger.js:41:11)
    at OptionManager.mergeOptions (/Users/Eric/Projects/highereducation/platform/src/node_modules/babel-core/lib/transformation/file/options/option-manager.js:262:18)
    at OptionManager.init (/Users/Eric/Projects/highereducation/platform/src/node_modules/babel-core/lib/transformation/file/options/option-manager.js:416:10)
    at File.initOptions (/Users/Eric/Projects/highereducation/platform/src/node_modules/babel-core/lib/transformation/file/index.js:191:75)
    at new File (/Users/Eric/Projects/highereducation/platform/src/node_modules/babel-core/lib/transformation/file/index.js:122:22)
    at Pipeline.transform (/Users/Eric/Projects/highereducation/platform/src/node_modules/babel-core/lib/transformation/pipeline.js:42:16)
    at transpile (/Users/Eric/Projects/highereducation/platform/src/node_modules/babel-loader/index.js:14:22)
    at /Users/Eric/Projects/highereducation/platform/src/node_modules/babel-loader/lib/fs-cache.js:145:18
    at ReadFileContext.callback (/Users/Eric/Projects/highereducation/platform/src/node_modules/babel-loader/lib/fs-cache.js:28:23)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:324:13)
 @ ./src/client.js 21:14-33

I researched this for an hour and the best I could find out is that somewhere somehow there are runtime dependency issues (of course) and old versions are still being used.

No idea how to fix this.

Maybe instead of relying on passPerPreset this plugin will have to wrap babel-plugin-react-transform like https://github.com/danmartinez101/babel-preset-react-hmre does.

That way this can run first & control the output rather than competing.

@ericclemmons
Copy link
Owner Author

Ok, I couldn't get this working in a local project for the life of me.

So, instead, I'm going to base functionality off of the example. If that works & can be a guide then I consider this a success.

@thangngoc89
Copy link

👍

1 similar comment
@imranismail
Copy link

👍

@ericclemmons
Copy link
Owner Author

Because gaearon/babel-plugin-react-transform#85 has hit a snag (largely self-imposed, IMO, and tools of this nature require understanding the caveats of improved functionality), if this feature gets delayed further, some next steps would be:

  1. Close this project in favor of my fork.
  2. Rename the fork to babel-preset-react-functional-hmre.
  3. Replace options with defaults.
  4. Add other presets to simplify development.

Improve new & improved workflow!

@ericclemmons
Copy link
Owner Author

Merging just to close.

@ericclemmons ericclemmons merged commit 87112ba into master Feb 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants