Support a script tag only for the full build

This commit is contained in:
Tim Schaub
2022-08-29 12:17:10 -06:00
parent 1614a27ee1
commit 8a9bf4ac7a
3 changed files with 3 additions and 40 deletions

View File

@@ -8,7 +8,7 @@ export default {
name: 'ol',
format: 'umd',
exports: 'default',
file: 'build/full/ol.cjs',
file: 'build/full/ol.js',
globals: {
geotiff: 'geotiff',
},

View File

@@ -1,37 +0,0 @@
import TerserPlugin from 'terser-webpack-plugin';
import path from 'path';
export default {
entry: './build/index.js',
devtool: 'source-map',
mode: 'production',
target: ['browserslist'],
resolve: {
fallback: {
fs: false,
http: false,
https: false,
},
alias: {
ol: path.resolve('./build/ol'),
},
},
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
// Mangle private members convention with underscore suffix
mangle: {properties: {regex: /_$/}},
},
}),
],
},
output: {
path: path.resolve('./build/legacy'),
publicPath: 'auto',
filename: 'ol.js',
library: 'ol',
libraryTarget: 'umd',
libraryExport: 'default',
},
};

View File

@@ -5,8 +5,8 @@ import {fileURLToPath} from 'url';
const baseDir = dirname(fileURLToPath(import.meta.url));
const buildDir = path.resolve(baseDir, '../build/ol');
const fullBuildSource = path.resolve(baseDir, '../build/full/ol.cjs');
const fullBuildDest = path.join(buildDir, 'dist/index.cjs');
const fullBuildSource = path.resolve(baseDir, '../build/full/ol.js');
const fullBuildDest = path.join(buildDir, 'dist/index.js');
async function main() {
const pkg = await fse.readJSON(path.resolve(baseDir, '../package.json'));