Created
January 3, 2019 18:12
-
-
Save SovietFrontier/d6d88147affd6a69e7baa97ce32dee79 to your computer and use it in GitHub Desktop.
webpack.config for inline css and html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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