Skip to content

Fix issue #4 Error when building with webpack 2 on linux #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion build/webpack.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ module.exports = {
externals: {
// This prevent bundling the AutoNumeric library inside the vue-autornumeric component
// cf. https://webpack.js.org/configuration/externals/
AutoNumeric: 'AutoNumeric',
autonumeric : {
commonjs2: 'autonumeric',
commonjs: 'autonumeric',
amd: 'autonumeric',
root: 'AutoNumeric', // indicates global variable
},
},
};
3 changes: 3 additions & 0 deletions build/webpack.examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const webpack = require('webpack');
const options = require('./options');
const base = require('./webpack.base.js');

// do not exclude the autonumeric in the bundle of the examples page
delete base.externals;

const config = merge(base, {
entry: options.paths.resolve('examples-src/index.js'),

Expand Down
14 changes: 7 additions & 7 deletions dist/vue-autonumeric.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("AutoNumeric"));
module.exports = factory(require("autonumeric"));
else if(typeof define === 'function' && define.amd)
define("VueAutonumeric", ["AutoNumeric"], factory);
define("VueAutonumeric", ["autonumeric"], factory);
else if(typeof exports === 'object')
exports["VueAutonumeric"] = factory(require("AutoNumeric"));
exports["VueAutonumeric"] = factory(require("autonumeric"));
else
root["VueAutonumeric"] = factory(root["AutoNumeric"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_43__) {
Expand Down Expand Up @@ -284,9 +284,9 @@ var _assign = __webpack_require__(15);

var _assign2 = _interopRequireDefault(_assign);

var _AutoNumeric = __webpack_require__(43);
var _autonumeric = __webpack_require__(43);

var _AutoNumeric2 = _interopRequireDefault(_AutoNumeric);
var _autonumeric2 = _interopRequireDefault(_autonumeric);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

Expand Down Expand Up @@ -338,7 +338,7 @@ exports.default = {
options = this.manageOptionElement(this.options);
}

this.anElement = new _AutoNumeric2.default(this.$refs.autoNumericInput, options);
this.anElement = new _autonumeric2.default(this.$refs.autoNumericInput, options);
if (this.value !== null && this.value !== '') {
this.anElement.set(this.value);

Expand All @@ -363,7 +363,7 @@ exports.default = {
manageOptionElement: function manageOptionElement(optionElement) {
var options = void 0;
if (typeof optionElement === 'string' || optionElement instanceof String) {
options = _AutoNumeric2.default.getPredefinedOptions()[optionElement];
options = _autonumeric2.default.getPredefinedOptions()[optionElement];
if (options === void 0 || options === null) {
console.warn('The given pre-defined options [' + optionElement + '] is not recognized by autoNumeric.\nSwitching back to the default options.');
options = defaultOptions;
Expand Down
2 changes: 1 addition & 1 deletion dist/vue-autonumeric.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/examples.bundle.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
</head>
<body>
<div id="app"></div>
<script src="https://unpkg.com/autonumeric"></script>
<script src="examples.bundle.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion src/components/VueAutonumeric.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ OTHER DEALINGS IN THE SOFTWARE.
</template>

<script type="text/babel">
import AutoNumeric from 'AutoNumeric';
import AutoNumeric from 'autonumeric';

// Custom default autoNumeric option can be set here to override the default autoNumeric ones
const defaultOptions = {};
Expand Down