47 lines
842 B
JavaScript
47 lines
842 B
JavaScript
const path = require( 'path' );
|
|
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
|
|
|
|
module.exports = {
|
|
...defaultConfig,
|
|
entry: './src/index.tsx',
|
|
module: {
|
|
...defaultConfig.module,
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
use: 'ts-loader',
|
|
exclude: /node_modules/,
|
|
},
|
|
{
|
|
test: /\.svg$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'svg-react-loader',
|
|
options: {
|
|
jsx: true,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
test: /\.scss$/,
|
|
use: [ 'style-loader', 'sass-loader' ],
|
|
},
|
|
...defaultConfig.module.rules,
|
|
],
|
|
},
|
|
|
|
resolve: {
|
|
...defaultConfig.resolve,
|
|
alias: {
|
|
"@": path.resolve( __dirname, 'src' ),
|
|
},
|
|
extensions: [ '.tsx', '.ts', '.js', '.jsx' ],
|
|
},
|
|
|
|
output: {
|
|
...defaultConfig.output,
|
|
filename: 'index.js',
|
|
path: path.resolve( __dirname, 'dist' ),
|
|
},
|
|
};
|