Skip to content

Commit

Permalink
fix: generate styles
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki committed Mar 14, 2024
1 parent 9e0214f commit 2264a64
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ const splitChunks = {
cacheGroups: {
defaultVendors: { // everything not specified in other cache groups
name: 'vendor-rest',
// test: /[\\/]node_modules[\\/]/,
test: /[\\/]node_modules[\\/]/,
priority: -10,
chunks: 'all'
},
styles: {
minChunks: 1,
name: 'styles',
type: 'css/mini-extract',
test: /.+\.css/,
chunks: 'initial',
enforce: true
},
Expand All @@ -51,15 +51,16 @@ const splitChunks = {

const paths = {
// Source files
src: path.resolve(__dirname, './dist-esbuild'),
distTsc: path.resolve(__dirname, './dist-tsc/src'),
// testSrc: path.resolve(__dirname, './webpack-tests'),
testBuild: path.resolve(__dirname, './test-build'),

// Production build files
build: path.resolve(__dirname, './dist')
build: path.resolve(__dirname, './dist'),

// Static files that get copied to build folder
public: path.resolve(__dirname, './public')
}
// Static files that get copied to build folder
paths.public = path.resolve(paths.src, './public')

/**
* @type {import('webpack').Configuration}
Expand Down Expand Up @@ -157,7 +158,7 @@ const dev = {
const common = {
// Where webpack looks to start building the bundle
entry: {
main: paths.src + '/index.js'
main: paths.distTsc + '/index.jsx'
},
output: {
path: paths.build,
Expand Down Expand Up @@ -204,6 +205,27 @@ const common = {
rules: [
// aegir has already built the JS for us with tsc & esbuild
// { test: /\.[j]s?$/,},
{
test: /\.jsx$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-typescript',
[
'@babel/preset-env',
{
targets: {
esmodules: true
}
}
],
'@babel/preset-react'
]
}
}
},

// Images: Copy image files to build folder
{ test: /\.(?:ico|gif|png|jpg|jpeg)$/i, type: 'asset/resource' },
Expand All @@ -221,7 +243,7 @@ const common = {
},

resolve: {
modules: [paths.src, 'node_modules'],
modules: [paths.distTsc, 'node_modules'],
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx']
},

Expand Down

0 comments on commit 2264a64

Please sign in to comment.