4.0.1 • Published 7 months ago

@livingdocs/fastify-webpack v4.0.1

Weekly downloads
504
License
MIT
Repository
github
Last release
7 months ago

@livingdocs/fastify-webpack

More details will follow

npm install fastify @livingdocs/fastify-webpack
npm install --save-dev fastify-webpack-hmr
const fastify = require('fastify')
const fastifyWebpack = require('@livingdocs/fastify-webpack')

const watch = process.argv.slice(2).includes('watch')
const optimized = process.argv.slice(2).includes('optimize')

fastify.register(fastifyWebpack, {
  watch,
  // Force the expiration when `watch` isn't true
  maxAge: '1y',
  // we can define the cdnurl
  cdnUrl: 'https://somecdn.yourproject.com',
  // optional, by default it uses webpack.config.js
  webpackConfig: require('./custom-webpack-config')
})

fastify.get('/', fastify.webpackHtml({
  body: '<h1>Hello</h1>'
}))
const fastifyWebpack = require('@livingdocs/fastify-webpack')
module.exports = {
  context: __dirname,
  mode: optimized ? 'production' : 'development',
  stats: false,
  entry: {
    index: './src/index.js'
  },
  output: {
    // make sure that there's no `/` in the front, so all the assets
    // are referenced using relative urls.
    // This allows us to host the files anywhere on any url, even subdirectories
    publicPath: 'assets/',
    filename: optimized ? '[name].[contenthash].js' : '[name].[hash].js',
    chunkFilename: optimized ? '[name].[contenthash].js' : '[name].[hash].js'
  },
  plugins: [new fastifyWebpack.AssetManifestPlugin()]
}
4.0.1

7 months ago

4.0.0

2 years ago

3.1.1

2 years ago

3.1.0

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.2

4 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago