Skip to content
Permalink
Browse files

Setup Webpack Encore

  • Loading branch information...
Kocal committed Aug 12, 2019
0 parents commit f17e144ed7c3ed957ff9bb6301725a581bb7e2ef
Showing with 6,426 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +10 −0 README.md
  3. +12 −0 index.html
  4. +17 −0 package.json
  5. +1 −0 src/index.js
  6. +79 −0 webpack.config.js
  7. +6,303 −0 yarn.lock
@@ -0,0 +1,4 @@
/node_modules
/dist
/npm-debug.log
/yarn-error.log
@@ -0,0 +1,10 @@
# Webpack Encore: CKEditor 5 from source

This repo shows how to build CKEditor 5 from source, with Webpack Encore.

## Local reproduction

- Clone this repo
- Install dependencies: `yarn`
- Run Webpack's dev-server: `yarn dev-server`
- Open http://localhost:8080
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div id="app"></div>
</body>
</html>
@@ -0,0 +1,17 @@
{
"devDependencies": {
"@symfony/webpack-encore": "^0.28.0",
"core-js": "^3.0.0",
"html-webpack-plugin": "^3.2.0",
"regenerator-runtime": "^0.13.2",
"webpack-notifier": "^1.6.0"
},
"license": "UNLICENSED",
"private": true,
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production --progress"
}
}
@@ -0,0 +1 @@
console.log('Test');
@@ -0,0 +1,79 @@
var Encore = require('@symfony/webpack-encore');
var HtmlWebpackPlugin = require('html-webpack-plugin')

// Manually configure the runtime environment if not already configured yet by the "encore" command.
// It's useful when you use tools that rely on webpack.config.js file.
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}

Encore
// directory where compiled assets will be stored
.setOutputPath('dist')
// public path used by the web server to access the output path
.setPublicPath('/')
// only needed for CDN's or sub-directory deploy
//.setManifestKeyPrefix('build/')

/*
* ENTRY CONFIG
*
* Add 1 entry for each "page" of your app
* (including one that's included on every page - e.g. "app")
*
* Each entry will result in one JavaScript file (e.g. app.js)
* and one CSS file (e.g. app.css) if your JavaScript imports CSS.
*/
.addEntry('app', './src/index.js')
//.addEntry('page1', './assets/js/page1.js')
//.addEntry('page2', './assets/js/page2.js')

// When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
.splitEntryChunks()

// will require an extra script tag for runtime.js
// but, you probably want this, unless you're building a single-page app
.enableSingleRuntimeChunk()

/*
* FEATURE CONFIG
*
* Enable & configure other features below. For a full
* list of features, see:
* https://symfony.com/doc/current/frontend.html#adding-more-features
*/
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction())
// enables hashed filenames (e.g. app.abc123.css)
.enableVersioning(Encore.isProduction())

// enables @babel/preset-env polyfills
.configureBabel(() => {}, {
useBuiltIns: 'usage',
corejs: 3
})

// enables Sass/SCSS support
//.enableSassLoader()

// uncomment if you use TypeScript
//.enableTypeScriptLoader()

// uncomment to get integrity="..." attributes on your script & link tags
// requires WebpackEncoreBundle 1.4 or higher
//.enableIntegrityHashes(Encore.isProduction())

// uncomment if you're having problems with a jQuery plugin
//.autoProvidejQuery()

// uncomment if you use API Platform Admin (composer req api-admin)
//.enableReactPreset()
//.addEntry('admin', './assets/js/admin.js')

.addPlugin(new HtmlWebpackPlugin({
template: 'index.html',
}))
;

module.exports = Encore.getWebpackConfig();

0 comments on commit f17e144

Please sign in to comment.
You can’t perform that action at this time.