-
Notifications
You must be signed in to change notification settings - Fork 1k
Adds section for commonjs support #1989
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,38 @@ <h3> | |
|
||
</div> | ||
|
||
<h3><a name="user-content-commonjs-support" class="anchor" href="#commonjs-support"><span class="octicon octicon-link"></span></a>CommonJS Support</h3> | ||
|
||
<p>If you use a CommonJS build system (such as <a href="https://webpack.github.io/">Webpack</a> or <a href="http://browserify.org/">Browserify</a>), we recommend only loading the controls you need. You can also load all the controls by including the npm package.</p> | ||
|
||
<h4>Working with Browserify</h4> | ||
|
||
<p>This should work out of the box with Browserify.</p> | ||
|
||
<h4>Working with webpack</h4> | ||
|
||
{% highlight js %} | ||
npm install --save-dev imports-loader | ||
// or | ||
yarn add --dev imports-loader | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove yarn reference. npm 5 essentially is yarn. we do not reference yarn elsewhere nor plan to. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agree to disagree, but done |
||
{% endhighlight %} | ||
|
||
{% highlight js %} | ||
// webpack 2 config | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove reference to webpack 2 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, why did we remove this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @RodEsp, we deleted this for the reason of being progressive. The way that the docs state it now is, "add a rule," which references webpack 2. If someone is using webpack 1, they can easily search for a backport. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got ya. Thanks @vernak2539. |
||
// add as a rule to module.rule | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be added to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh... my bad.. webpack 2. Sorry. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should push for progression. If people need to integrate with webpack 1, they can look it up? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, sounds good to me. |
||
{ | ||
test: /fuelux\/js\/.*\.js$/, | ||
use: ['imports-loader?define=>false'] | ||
} | ||
{% endhighlight %} | ||
|
||
{% highlight js %} | ||
// include where you need to | ||
require('fuelux/js/checkbox') | ||
// or | ||
require('fuelux') | ||
{% endhighlight %} | ||
|
||
<div class="fu-docs-section"> | ||
<!-- Cross link to new migration page --> | ||
<div class="fu-callout fu-callout-info"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
--save-dev
new versions of npm save automagically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they "automagically" save to dependencies, not devdeps.
And I don't think we should assume as this (below) makes no illusion to force you to npm v5