| const path = require('path') | |
| const MiniCssExtractPlugin = require('mini-css-extract-plugin') | |
| const { VanillaExtractPlugin } = require('@vanilla-extract/webpack-plugin') | |
| const out_path = path.resolve(process.cwd(), 'dist') | |
| module.exports = { | |
| entry: path.join(process.cwd(), 'index.js'), | |
| mode: 'development', | |
| stats: 'errors-warnings', | |
| resolve: { | |
| extensions: ['.js', '.ts'], | |
| }, | |
| devtool: 'source-map', | |
| output: { | |
| filename: 'main.js', | |
| path: out_path, | |
| }, | |
| module: { | |
| rules: [ | |
| { | |
| test: /\.vanilla\.css$/i, // Targets only CSS files generated by vanilla-extract | |
| use: [ | |
| MiniCssExtractPlugin.loader, | |
| { | |
| loader: require.resolve('css-loader'), | |
| options: { | |
| url: false, // Required as image imports should be handled via JS/TS import statements | |
| }, | |
| }, | |
| ], | |
| }, | |
| ], | |
| }, | |
| plugins: [new VanillaExtractPlugin(), new MiniCssExtractPlugin()], | |
| } |