Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SovietFrontier/d6d88147affd6a69e7baa97ce32dee79 to your computer and use it in GitHub Desktop.
Save SovietFrontier/d6d88147affd6a69e7baa97ce32dee79 to your computer and use it in GitHub Desktop.
webpack.config for inline css and html
const path = require('path');
var HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/directoryFile/directoryFile.ts',
output: {
filename: 'directoryFile.js',
path: path.resolve(__dirname, 'dist/directoryFile')
},
mode: 'production',
module: {
rules: [
{
test: /\.ts?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js']
},
plugins: [
new HtmlWebpackPlugin({
inlineSource: '.(js|css)$',
filename: 'directoryFile.html',
// title: 'titleHere',
template: 'src/directoryFile/directoryFileTemplate.html'
}),
new HtmlWebpackInlineSourcePlugin(),
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment