(entry)
| 8 | const webpackDevServerFrontendAddr = webpackDevServerHost === '0.0.0.0' ? '127.0.0.1' : webpackDevServerHost |
| 9 | |
| 10 | function createEntry(entry) { |
| 11 | const commonLoadersForSassAndLess = [ |
| 12 | { |
| 13 | loader: 'style-loader', |
| 14 | }, |
| 15 | { |
| 16 | // This loader resolves url() and @imports inside CSS |
| 17 | loader: 'css-loader', |
| 18 | }, |
| 19 | { |
| 20 | // Then we apply postCSS fixes like autoprefixer and minifying |
| 21 | loader: 'postcss-loader', |
| 22 | }, |
| 23 | ] |
| 24 | |
| 25 | return { |
| 26 | name: entry, |
| 27 | mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', |
| 28 | devtool: |
| 29 | process.env.GENERATE_SOURCEMAP === 'false' |
| 30 | ? false |
| 31 | : process.env.NODE_ENV === 'production' |
| 32 | ? 'source-map' |
| 33 | : 'inline-source-map', |
| 34 | entry: { |
| 35 | [entry]: entry === 'main' || entry === 'cypress' ? './frontend/src/index.tsx' : null, |
| 36 | }, |
| 37 | watchOptions: { |
| 38 | ignored: /node_modules/, |
| 39 | }, |
| 40 | output: { |
| 41 | path: path.resolve(__dirname, 'frontend', 'dist'), |
| 42 | filename: '[name].js', |
| 43 | chunkFilename: '[name].[contenthash].js', |
| 44 | publicPath: process.env.JS_URL |
| 45 | ? `${process.env.JS_URL}${process.env.JS_URL.endsWith('/') ? '' : '/'}static/` |
| 46 | : process.env.NODE_ENV === 'production' |
| 47 | ? '/static/' |
| 48 | : `http${process.env.LOCAL_HTTPS ? 's' : ''}://${webpackDevServerFrontendAddr}:8234/static/`, |
| 49 | }, |
| 50 | resolve: { |
| 51 | extensions: ['.js', '.jsx', '.ts', '.tsx'], |
| 52 | alias: { |
| 53 | '~': path.resolve(__dirname, 'frontend', 'src'), |
| 54 | lib: path.resolve(__dirname, 'frontend', 'src', 'lib'), |
| 55 | scenes: path.resolve(__dirname, 'frontend', 'src', 'scenes'), |
| 56 | '@posthog/apps-common': path.resolve(__dirname, 'frontend', '@posthog', 'apps-common', 'src'), |
| 57 | '@posthog/lemon-ui': path.resolve(__dirname, 'frontend', '@posthog', 'lemon-ui', 'src'), |
| 58 | storybook: path.resolve(__dirname, '.storybook'), |
| 59 | types: path.resolve(__dirname, 'frontend', 'types'), |
| 60 | public: path.resolve(__dirname, 'frontend', 'public'), |
| 61 | cypress: path.resolve(__dirname, 'cypress'), |
| 62 | }, |
| 63 | }, |
| 64 | module: { |
| 65 | rules: [ |
| 66 | { |
| 67 | test: /\.[jt]sx?$/, |
no test coverage detected
searching dependent graphs…