Migration Guide
No API changes, but lots of dependency changes. You'll want to remove all
node_modules
so Elixir can install the needed dependencies and version.- Node 16+
- Webpack 5
- Node Sass has been removed in favor of Dart Sass
- Removes Python dependency
- Removes usages of node-gyp
- Supports Vue 2 and Vue 3
After the installation, you may notice old Webpack plugins that are no longer needed as of Webpack 5. You may safely remove these.
You will need to tweak your
package.json
scripts to account for Webpack 5:{
"scripts": {
"dev": "webpack --node-env development",
"watch": "npm run dev -- --watch",
"prod": "webpack --node-env production"
}
}
Lastly, we've introduced a new
enableDevtools
flag that can be used to force devtools in production environments:const elixir = require("coldbox-elixir");
elixir.enableDevtools = true;
module.exports = elixir(mix => {
// ...
});
You do not need to do this for non-production environments. The devtools will be enabled automatically there.
If you used a previous version of ColdBox Elixir a lot has changed. This guide will step you through the changes.
ColdBox Elixir no longer requires
gulp
. You can uninstall it.ColdBox Elixir will install all necessary dependencies when installing or updating it from NPM. There are other dependencies which may be installed on-demand once as you use them.
Since ColdBox Elixir doesn't use
gulp
any more, we need to make some changes to our gulpfile.js
.- 1.Rename
gulpfile.js
towebpack.config.js
. - 2.Export the result of
elixir()
// webpack.config.js
const elixir = require("coldbox-elixir");
module.exports = elixir(mix => {
// ....
});
- 1.(Optional) Create some NPM scripts to make build commands easier to remember. This let's us run
npm run dev
ornpm run watch
to build our project.
{
"scripts": {
"dev": "webpack",
"watch": "npm run dev -- --watch",
"build": "npm run dev -- -p"
}
}
Due to the way Webpack processes css files, you can no longer have a css file named
vendor
.The following tasks have been removed from ColdBox Elixir.
mix.less
mix.combine
mix.browserify
mix.rollup
mix.exec
If you rely on any of these methods you can either stay with ColdBox Elixir v2 or you can recreate the task yourself.
mix.styles
should be replaced with mix.css
.The method signature for
mix.css
is has changed.Name | Type | Required | Default | Description |
filename | String | true | | The filename to bundle. |
options | Object | false | (see below) | An object for additional options. Any missing keys will use their default value. |
options.name | String | false | The name of the filename without the extension | The name of the outputed bundle |
options.outputDirectory | String | false | includes/css | The output directory for the built file. |
options.entryDirectory | String | false | resources/assets/css/ | The directory where the filename is located. |
mix.scripts
should be replaced with mix.js
. mix.js
will automatically run the code through Babel. Babel is preconfigured with babel-preset-env
, but it can be customized by specifying your own .babelrc
file in the root of your project. See the Babel docs for more information.The method signature for
mix.scripts
has changed.Name | Type | Required | Default | Description |
filename | String | true | | The filename to bundle. |
options | Object | false | (see below) | An object for additional options. Any missing keys will use their default value. |
options.name | String | false | The name of the filename without the extension | The name of the outputed bundle |
options.outputDirectory | String | false | includes/js | The output directory for the built file. |
options.entryDirectory | String | false | resources/assets/js/ | The directory where the filename is located. |
The method signature for
mix.js
and mix.vue
are the same.Name | Type | Required | Default | Description |
filename | String | true | | The filename to bundle. |
options | Object | false | (see below) | An object for additional options. Any missing keys will use their default value. |
options.name | String | false | The name of the filename without the extension | The name of the outputed bundle |
options.outputDirectory | String | false | includes/js | The output directory for the built file. |
options.entryDirectory | String | false | resources/assets/js/ | The directory where the filename is located. |
The method signature for
mix.sass
has changed.Name | Type | Required | Default | Description |
filename | String | true | | The filename to bundle. |
options | Object | false | (see below) | An object for additional options. Any missing keys will use their default value. |
options.name | String | false | The name of the filename without the extension | The name of the outputed bundle |
options.outputDirectory | String | false | includes/css | The output directory for the built file. |
options.entryDirectory | String | false | resources/assets/sass/ | The directory where the filename is located. |
Versioning is now the default for a production build (
webpack -p
). You can also control if the files are versioned by setting the elixir.versioning
config property in your webpack.config.js
file.These methods should be replaced with individual calls to
mix.css
and mix.js
.Extensions that were made for ColdBox Elixir v2 are not compatible with v3. See Writing Elixir Extensions for more information on how to create v3 compatible extensions.
The Elixir config file has changed completely. The available configuration options are available in Configuration Options.
Last modified 1yr ago