0.8.0 • Published 12 hours ago

@graphitation/embedded-document-artefact-loader v0.8.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 hours ago

@graphitation/embedded-document-artefact-loader

This is a simple set of webpack/jest loaders that will replace embedded GraphQL documents with an import of an external compiled artefact file. It is meant to remain agnostic of a specific AST form, so it can work with pipelines that use babel, tsc, esbuild, swc, etc.

It works for @graphitation/apollo-react-relay-duct-tape and react-relay.

webpack

const webpackConfig = {
  module: {
    rules: [
      {
        test: /.+?\.tsx?$/,
        exclude: /node_modules/,
        use: [
          {
            loader: "@graphitation/embedded-document-artefact-loader/webpack",
          },
        ],
      },
    ],
  },
};

If you are using the artifactDirectory option in your relay config you will need to direct the loader to the same folder.

const webpackConfig = {
  module: {
    rules: [
      {
        test: /.+?\.tsx?$/,
        exclude: /node_modules/,
        use: [
          {
            loader: "@graphitation/embedded-document-artefact-loader/webpack",
            options: {
              artifactDirectory: "path/to/your/artifact/directory",
            },
          },
        ],
      },
    ],
  },
};

Jest

The jest loader wraps ts-jest because there's no built-in way to chain loaders. The host still needs to provide ts-jest on their own.

const jestConfig = {
  transform: {
    "^.+\\.tsx?$": "@graphitation/embedded-document-artefact-loader/ts-jest",
  },
};

If you are using the artifactDirectory option in your relay config you will need to direct the loader to the same folder.

const jestConfig = {
  transform: {
    "^.+\\.tsx?$": [
      "@graphitation/embedded-document-artefact-loader/ts-jest",
      {
        artifactDirectory: "path/to/your/artifact/directory",
      },
    ],
  },
};

TODO

  • SourceMap support needs to be finished
0.8.0

12 hours ago

0.7.0

2 months ago

0.6.9

3 months ago

0.6.7

7 months ago

0.6.6

7 months ago

0.6.8

6 months ago

0.3.0

10 months ago

0.6.3

8 months ago

0.6.2

9 months ago

0.6.5

7 months ago

0.6.4

7 months ago

0.5.0

10 months ago

0.4.0

10 months ago

0.6.1

9 months ago

0.6.0

10 months ago

0.2.0

11 months ago