electron-userland / electron-webpack

Scripts and configurations to compile Electron applications using webpack
https://webpack.electron.build/
903 stars 170 forks source link

TSLint plugin #147

Open jstaro opened 6 years ago

jstaro commented 6 years ago

Normally, when using transpileOnly + ForkTsCheckerWebpackPlugin, you want to do linting in the ForkTsCheckerWebpackPlugin (which it supports by supplying a config object { tslint: '<path to tslint.json>'}). It's a one-liner.

Sadly, the current solution with hardcoded 'smart' webpack config merging does not allow you to replace (or remove) a plugin entry in the webpack config, so there's currently no way to add this support by yourself without losing CLI support :( (https://github.com/electron-userland/electron-webpack/issues/11, https://github.com/electron-userland/electron-webpack/issues/33, https://github.com/electron-userland/electron-webpack/issues/92). So, in lieu of a proper solution for more powerful config transformations, could TSLint be added as a plugin?

loopmode commented 6 years ago

See discussion in https://github.com/electron-userland/electron-webpack/issues/145#issuecomment-388873431

We should opt-out of implicit smart merging

jstaro commented 6 years ago

Great. I'm all for more control over the webpack config.

JM-Mendez commented 6 years ago

In case anyone is still interested in this, I just created a PR to allow custom typescript loaders. The only caveat is that it's all or nothing. Either you choose the default two plugins, or your own custom ones.

If you'd like to check out the branch to test it, you'll have to compile the branch locally and install it from that directory.

Here are the steps.

// install lerna globally if you don't have it
yarn global add lerna

// then
git clone https://github.com/JM-Mendez/electron-webpack
cd electron-webpack
git checkout feat/custom-typescript-loaders
lerna bootstrap
BABEL_ENV=production yarn run compile

Then to install

yarn install path-to-electron-webpack/packages/electron-webpack