-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
55 lines (50 loc) · 1.54 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const Encore = require('@symfony/webpack-encore');
const WatchExternalFilesPlugin = require('webpack-watch-files-plugin').default;
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}
Encore
.setOutputPath('src/Resources/public/build/')
.setPublicPath('/bundles/numberninechapterone/build')
.setManifestKeyPrefix('build/')
.addEntry('main', './assets/ts/index.ts')
.addEntry('product', './assets/ts/product.ts')
.addEntry('shop', './assets/ts/shop.ts')
.splitEntryChunks()
.enableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
.configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage';
config.corejs = 3;
})
.enableSassLoader()
.enableTypeScriptLoader()
.addRule({
enforce: 'pre',
test: /\.ts$/,
exclude: /node_modules/,
loader: 'eslint-loader',
})
.enablePostCssLoader((options) => {
options.postcssOptions = {
plugins: {
tailwindcss: {},
autoprefixer: {},
}
}
})
.addPlugin(new WatchExternalFilesPlugin({
files: [
'./src/**/*.twig',
'./assets/sass/purge_safelist.txt',
],
verbose: true
}))
.configureDevServerOptions(options => {
options.allowedHosts = 'all';
delete options.client;
})
;
module.exports = Encore.getWebpackConfig();