Split package into two files
parent
b3a4cd1593
commit
8f1d52e281
|
@ -10,7 +10,6 @@ const isDev = process.env.ROLLUP_WATCH || process.env.NODE_ENV === 'development'
|
|||
|
||||
const pkg = require('./package.json');
|
||||
|
||||
const inputFile = './src/index.ts';
|
||||
const outputDir = isDev ? './dev/' : './dist/';
|
||||
|
||||
const bannerText = `${pkg.name} v${pkg.version} by Nikita Karamov\n${pkg.homepage}`;
|
||||
|
@ -78,17 +77,32 @@ if (isDev) {
|
|||
output.push({
|
||||
name: pkg.name,
|
||||
format: 'iife',
|
||||
file: `${outputDir}${pkg.name}.min.js`,
|
||||
file: `${outputDir}${pkg.name}.noinit.min.js`,
|
||||
plugins: [terser({ output: { comments: false } })],
|
||||
});
|
||||
}
|
||||
|
||||
const config = [{
|
||||
input: isDev ? './src/autoinit.ts' : './src/shareon.ts',
|
||||
output,
|
||||
plugins,
|
||||
}];
|
||||
|
||||
if (!isDev) {
|
||||
config.push({
|
||||
input: './src/autoinit.ts',
|
||||
output: {
|
||||
name: pkg.name,
|
||||
format: 'iife',
|
||||
file: `${outputDir}${pkg.name}.min.js`,
|
||||
plugins: [terser({ output: { comments: false } })],
|
||||
},
|
||||
plugins,
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* EXPORT
|
||||
*/
|
||||
|
||||
export default {
|
||||
input: inputFile,
|
||||
output,
|
||||
plugins,
|
||||
};
|
||||
export default config;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
import initializeShareon from './shareon';
|
||||
|
||||
window.onload = () => {
|
||||
initializeShareon();
|
||||
};
|
||||
|
||||
export default initializeShareon;
|
|
@ -71,6 +71,4 @@ const initializeShareon = () : void => {
|
|||
}
|
||||
};
|
||||
|
||||
window.onload = () => { initializeShareon(); };
|
||||
|
||||
export default initializeShareon;
|
Loading…
Reference in New Issue