0.1.5-beta5 • Published 7 years ago
@hellpack/packer v0.1.5-beta5
@hellpack/packer
Preconfigured Webpack for easy setup of Modern Js application.
Getting Started
# Install Dependencies
$ yarn add @hellpack/packer
$ yarn add @hellpack/eslint-config-hellpack eslint -D
Now in your entry file
const polyfill = require('@hellpack/packer/lib/polyfill')
polyfill({ dev: 'path_to_dev_file', prod: 'path_to_prod_file'})
The polyfill
function will choose the file according to NODE_ENV
in environment variables
NODE_ENV = development
will run the dev file while
NODE_ENV = production
will run the prod file.
Create your build script
const builder = require('@hellpack/packer');
const config = require('../config');
builder(config).then(_ => console.log('Done')).catch(e => console.log(e));
Where the contents of your config file should be
const path = require('path');
const entry = [path.resolve(__dirname, 'path_to_dev_file')];
const output = {
path: path.resolve(__dirname, 'path_to_prod_dir'),
filename: 'prod_file_name.js'
};
module.exports = { entry, output }
Advanced Configuration
- Adding Evnvironment Configuration
const attachConfig = require('@hellpack/packer/lib/attachConfig')
attachConfig({ dev: 'path_to_dev_config', prod: 'path_to_prod_config' })
Now use like this in code
const port = config().port
Assuming your config is
export default {
port: 3000
}
- Added Additional Environments
const polyfill = require('@hellpack/packer/lib/polyfill')
polyfill({ dev: 'path_to_dev_file', prod: 'path_to_prod_file', live: 'path_to_live_file' })
The live file entry will be chosen when NODE_ENV=live
By default the entries except dev
or development
are not prebuilt by Hellpack.
So this is also possible
const polyfill = require('@hellpack/packer/lib/polyfill')
polyfill({ development: 'path_to_dev_file', production: 'path_to_prod_file', live: 'path_to_live_file' })
will work exactly similar to this
const polyfill = require('@hellpack/packer/lib/polyfill')
polyfill({ dev: 'path_to_dev_file', prod: 'path_to_prod_file', live: 'path_to_live_file' })
And this is also possible
const attachConfig = require('@hellpack/packer/lib/attachConfig')
attachConfig({ dev: 'path_to_dev_config', prod: 'path_to_prod_config', live: 'path_to_live_config' })
0.1.5-beta5
7 years ago
0.1.5-beta4
7 years ago
0.1.5-beta3
7 years ago
0.1.5-beta2
7 years ago
0.1.5-beta1
7 years ago
0.1.4-beta1
7 years ago
0.1.4
7 years ago
0.1.3
7 years ago
0.1.2
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago
0.0.1
7 years ago