Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactivity API: Add build configuration for a standalone package #61681

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ test/gutenberg-test-themes/twentytwentyone
test/gutenberg-test-themes/twentytwentythree
test/gutenberg-test-themes/twentytwentyfour
packages/react-native-editor/src/setup-local.js

# Interactivity API standalone build
dist
3 changes: 3 additions & 0 deletions packages/interactivity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "webpack --config webpack.config.js"
}
}
67 changes: 67 additions & 0 deletions packages/interactivity/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* THIS FILE IS USED ONLY FOR BUILDING THE STANDALONE VERSION OF THE
* INTERACTIVITY PACKAGE FOR USE ON A CDN OR IN A NON-WP ENVIRONMENT.
*/

/**
* External dependencies
*/
const { join } = require( 'path' );

/**
* Internal dependencies
*/
const { baseConfig } = require( '../../tools/webpack/shared' );

module.exports = {
...baseConfig,
name: 'interactivity-standalone',
entry: {
index: './src/index',
debug: './src/debug',
},
experiments: {
outputModule: true,
},
output: {
devtoolNamespace: 'wp',
filename: './packages/interactivity/dist/[name]-standalone.min.js',
library: {
type: 'module',
},
path: join( __dirname, '..', '..' ),
environment: { module: true },
module: true,
chunkFormat: 'module',
},
resolve: {
extensions: [ '.js', '.ts', '.tsx' ],
},
module: {
rules: [
{
test: /\.(j|t)sx?$/,
exclude: /node_modules/,
use: [
{
loader: require.resolve( 'babel-loader' ),
options: {
cacheDirectory:
process.env.BABEL_CACHE_DIRECTORY || true,
babelrc: false,
configFile: false,
presets: [
'@babel/preset-typescript',
'@babel/preset-react',
],
},
},
],
},
],
},
watchOptions: {
ignored: [ '**/node_modules' ],
aggregateTimeout: 500,
},
};
Loading