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}`;
|
||||
|
@ -76,10 +75,29 @@ if (isDev) {
|
|||
file: `${outputDir}${pkg.name}.mjs`,
|
||||
});
|
||||
output.push({
|
||||
name: pkg.name,
|
||||
format: 'iife',
|
||||
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,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -87,8 +105,4 @@ if (isDev) {
|
|||
* 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