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

TypeScript #45

Open
TheKnarf opened this issue Aug 7, 2020 · 3 comments
Open

TypeScript #45

TheKnarf opened this issue Aug 7, 2020 · 3 comments

Comments

@TheKnarf
Copy link
Contributor

TheKnarf commented Aug 7, 2020

How to I set this up to work with TypeScript?

@MunGell
Copy link
Collaborator

MunGell commented Aug 20, 2020

Hi @TheKnarf

You can set it up to work with Typescript like this:

In your component file:

<script type="typescript">
...
</script>

In your webpack.conf.js file:

...
{
    test: /\.one$/,
    loader: 'one-loader',
    options: {
        map: {
            'text/scss': [MiniCssExtractPlugin.loader, 'css-loader?modules=true', 'sass-loader'],
            'typescript': 'ts-loader'
        }
    }
},
...

Make sure all required modules are installed as well.

If you want to compile Typescript with babel, change .babelrc file, like it is described here: https://medium.com/@francesco.agnoletto/how-to-set-up-typescript-with-babel-and-webpack-6fba1b6e72d5

Have a look at Example 02 to see how it works with SCSS styles (similar concept applies there): https://github.com/digitalie/one-loader/tree/master/examples/02_redux-todos

@TheKnarf
Copy link
Contributor Author

Maybe we could add a TypeScript example?

@MunGell
Copy link
Collaborator

MunGell commented Aug 21, 2020

Absolutely, feel free to contribute an example with it - will be much appreciated!

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