Views: 1352
Last Modified: 07.04.2022
Previous article has covered the console tool
@bitrix/cli
@bitrix/cli is a Bitrix24 developer console tool. The main purpose is to simplify and automate frontend development for Bitrix24 projects.
The following are requirements for normal operation, versions:
Node: 9.11.2
NPM: 5.6.0.
Learn more...
. In this article, we'll overview how to execute assembly for projects with
NPM
NPM (Node Package Manager) is a package manager for JavaScript and for node.js by default. It's used for downloading packages from NPM cloud-based server, or for uploading packages to such servers.
.
|
Building project with NPM |
- Create package.json.
Next, declare external dependencies, necessary for app operation. For example, when the application uses React, Lodash or any other library, these libraries must be described in package.json with indicated version and description of your project.
This will be useful for developers that are going to develop your application in the future.
You can quickly create package.json using the command npm init
. It will launch an assembly wizard with some questions for you to answer. You need to execute the command in the
extension directory.
Extension is is a method of organizing JS and CSS code in software.
Learn more...
- Indicate the parameter
plugins.resolve = true;
in the file bundle.config.js
This parameter informs the assembler on all NPM package imports must be allowed ("resolved") and added to your app's bundle.
Example of bundle.config.js, already configured for handling NPM packages:
module.exports = {
input: 'src/app.js',
output: 'dist/app.bundle.js',
plugins: {
resolve: true,
},
};