insomnia/packages/insomnia-components/webpack/webpack.common.js
Dimitri Mitropoulos 5f4c19da35
[TypeScript] Phase 1 & 2 (#3370)
Co-authored-by: Opender Singh <opender.singh@konghq.com>
2021-05-12 18:35:00 +12:00

39 lines
1.1 KiB
JavaScript

const path = require('path');
const createStyledComponentsTransformer = require('typescript-plugin-styled-components').default;
const styledComponentsTransformer = createStyledComponentsTransformer();
/** @type { import('webpack').Configuration } */
module.exports = {
entry: { index: './src/index.ts' },
target: 'web',
output: {
path: path.resolve(__dirname, '../dist'),
filename: '[name].js',
sourceMapFilename: '[name].js.map',
library: 'insomniaComponents',
libraryTarget: 'commonjs2',
},
optimization: {
// Disable minification for now, otherwise smoke tests fail
// Note, minification is disabled in insomnia-app as well
minimize: false,
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: [/node_modules/],
options: {
configFile: 'tsconfig.build.json',
getCustomTransformers: () => ({ before: [styledComponentsTransformer] }),
},
},
],
},
resolve: {
extensions: ['.js', '.json', '.ts', '.tsx'],
},
externals: ['react', 'react-dom', 'styled-components'],
};