Skip to content

Add an example how to adjust ts-loader settings #12508

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

Merged
merged 1 commit into from
Oct 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion frontend/encore/typescript.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,29 @@ Encore, you're done!

Any ``.ts`` files that you require will be processed correctly. You can
also configure the `ts-loader options`_ via the ``enableTypeScriptLoader()``
method. See the `Encore's index.js file`_ for detailed documentation and check
method.

.. code-block:: diff

Encore
// ...
.addEntry('main', './assets/main.ts')

- .enableTypeScriptLoader()
+ .enableTypeScriptLoader(function(tsConfig) {
+ // You can use this callback function to adjust ts-loader settings
+ // https://github.com/TypeStrong/ts-loader/blob/master/README.md#loader-options
+ // For example:
+ // tsConfig.silent = false
+ })

// optionally enable forked type script for faster builds
// https://www.npmjs.com/package/fork-ts-checker-webpack-plugin
// requires that you have a tsconfig.json file that is setup correctly.
//.enableForkedTypeScriptTypesChecking()
;

See the `Encore's index.js file`_ for detailed documentation and check
out the `tsconfig.json reference`_ and the `Webpack guide about Typescript`_.

If React is enabled (``.enableReactPreset()``), any ``.tsx`` file will also be
Expand Down